Google Maps API V3标题和信息窗口字符集
我有一个从SQL数据库中选择信息的谷歌地图。信息窗口的标题显示此信息 但是如果数据库中的值包含ä、ö、ü等,它将显示为NULL 我想我必须将字符集从UTF-8更改为ISO-8859-1,因为PHP站点已经有了这个字符集Google Maps API V3标题和信息窗口字符集,maps,character,iso-8859-1,Maps,Character,Iso 8859 1,我有一个从SQL数据库中选择信息的谷歌地图。信息窗口的标题显示此信息 但是如果数据库中的值包含ä、ö、ü等,它将显示为NULL 我想我必须将字符集从UTF-8更改为ISO-8859-1,因为PHP站点已经有了这个字符集 这可能吗?这是带有DB选项的部分: function displayLocation(location) { var image = 'img/pin_s.png'; var content = '<img src="' + location.ppic + '
这可能吗?这是带有DB选项的部分:
function displayLocation(location) {
var image = 'img/pin_s.png';
var content = '<img src="' + location.ppic + '" width="90" style="float:left; margin-right:8px; border:black 1px solid">'
+ '<div style="float:left" align="left" class="infoWindow">' + location.cattype + '<br/><br/><strong>' + location.firstname + ' ' + location.lastname + '</strong>'
+ '<br/>' + location.city
+ '<br/>' + location.country
+ '<br/><br/><a href="view_more.php?id=' + location.id + '">Show more ...</a></div>';
if (parseInt(location.lat) != 0) {
var position = new google.maps.LatLng(parseFloat(location.lat), parseFloat(location.lng));
var marker = new google.maps.Marker({
map: map,
position: position,
animation: google.maps.Animation.DROP,
title: location.firstname + ' ' + location.lastname,
icon: location.pin
});
omarkers.push( marker );
cmarkers.push( marker );
umarkers.push( marker );
google.maps.event.addListener(marker, 'click', function() {
//window.location.href = this.url;
infowindow.setContent(content);
infowindow.open(map,marker);
});
}
}
如果值包含一个ä、ö、ü等,location.firstname e.q.将显示为NULL。
这是一个MySQL5.5,里面的值包含这个特殊字符,将显示在view-more.php中
我可以在googlemaps location.lastname中将Mueller显示为title,如果我将db值更新为Müller,则title将NULL显示为Value
如何修复此问题?您使用的是什么SQL风格?也许您可以添加一些有关数据库排序规则的信息或提供一些相关的代码示例。我在ASP.net MVC6和GoogleMaps中遇到了类似的问题:从SQL Server加载地址,生成标记的标题。。。而德国的乌姆劳特语如ä,ö,ü则不正确。如何使用正确的地址设置字符串格式?这是作为答案发布的,但应编辑到问题中。