简体   繁体   中英

Display error UTF-8 character in label of Google Maps markers

I have file foo.ftl

<script>
        function initMap() {
            const map = new google.maps.Map(document.getElementById("map"), {
                zoom: 16,
                center: {lat: 20.993514917846174, lng: 105.78660475957122},
            });
            // const labels = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            const labels = [
                "The Light Trung Văn",
                "Khu đô thị Mulbery Lane",
                "Nhà thờ giáo xứ Phùng Khoang",
                "Khỏe đẹp 24h"];

            const locations = [
                { lat: 20.9935851166474, lng: 105.78857910579417 },
                { lat: 20.986910834987295, lng: 105.78535398147808 },
                { lat: 20.990339683019226, lng: 105.7922698253056 },
                { lat: 20.996770381033244, lng: 105.79321396285934 }
            ];

            const markers = locations.map((location, i) => {
                return new google.maps.Marker({
                    position: location,
                    label: labels[i % labels.length],
                });
            });

            new MarkerClusterer(map, markers, {
                imagePath:
                    "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",
            });

            const ecolife = {lat: 20.993514917846174, lng: 105.78660475957122};

            // const map22 = new google.maps.Map(document.getElementById("map"), {
            //     zoom: 18,
            //     center: ecolife,
            // });
            // const marker = new google.maps.Marker({
            //     position: ecolife,
            //     map: map22,
            // });
        }


    </script>

I see HTML source of web-page

在此处输入图像描述

Encoding in text editor

在此处输入图像描述

but still error font UTF-8

在此处输入图像描述

How to display text in UTF-8 correctly?

This is a defect of FreeMarker

<#ftl encoding="utf-8">

See https://freemarker.apache.org/docs/pgui_misc_charset.html#autoid_52

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM