javascript - 编码非拉丁字符谷歌地图标记信息

标签 javascript google-maps google-maps-api-3 character-encoding

我正在使用 Google map API 添加标记并向其添加信息,但问题在于阿拉伯字符,尽管页面编码为 utf-8,但它显示为奇怪的符号

enter image description here

var locations = [
  ['<div class="content" style="dir:rtl; text-align:right;">'+
  '<div id="siteNotice">'+
  '</div>'+
  '<h1 id="firstHeading" class="firstHeading"><?= "المنزل الأول" ?></h1>'+
  '<div id="bodyContent">'+
  '<p>العنوان بالتفصيل, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  'https://en.wikipedia.org/w/index.php?title=Uluru</a> '+
  '(last visited June 22, 2009).</p>'+
  '</div>'+
  '</div>', -33.890542, 151.274856, 4],
  ['<div class="content" style="dir:rtl; text-align:right;">'+
  '<div id="siteNotice">'+
  '</div>'+
  '<h1 id="firstHeading" class="firstHeading">المنزل الثاني</h1>'+
  '<div id="bodyContent">'+
  '<p>Attribution: Uluru, <a href="https://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
  'https://en.wikipedia.org/w/index.php?title=Uluru</a> '+
  '(last visited June 22, 2009).</p>'+
  '</div>'+
  '</div>', -33.923036, 151.259052, 5]
];

最佳答案

问题在于 notepad++ 编码从 ANSI 更改为 UTF-8,一切正常

关于javascript - 编码非拉丁字符谷歌地图标记信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30684471/

相关文章:

javascript - 将调试路径复制到对象数据 Visual Studio 代码 javascript

Google map 的 Selen 测试

PHP - Google Maps API 搜索返回 ZERO_RESULTS 但 Navigator 显示它

javascript - 如何使用 google maps api V3 显示建筑物的室内平面图

javascript - javascript中作用域和命名空间有什么区别

javascript - 我的剪刀石头布游戏无法正确重复 - 有什么想法吗?

javascript - padStart 有什么替代品

php - Google Maps V3 Zoom to Show all markers 不工作

php - 如何将动态谷歌地图添加到我的网站?

javascript - 如何在循环内创建动态变量名?