I’m using PHP&MySQL, the location name data comes from my database. Location should be plotted in Google Maps, I have this code inside a loop:
$accum_str .= "$('#map_addresses').gMap('addMarker', {";
$accum_str .= "latitude: {$location['Location']['latitude']},";
$accum_str .= "longitude: {$location['Location']['longitude']},";
$accum_str .= "content: '" . htmlspecialchars($location['Location']['name']) . "',";
$accum_str .= "icon: {";
$accum_str .= "image: \"http://myappdomain.com/img/pin.png\",";
$accum_str .= "iconsize: [26, 46],";
$accum_str .= "iconanchor: [12, 46]";
$accum_str .= "},";
$accum_str .= "popup: false";
$accum_str .= "});";
Now, if all location names were in normal characters, for example:
Bambie store
It renders the Google maps. But if the characters were Vietnamese or Thai like:
Thích Quảng Đức Phú Nhu
or
กรุงเทพมหานคร Bangkok
…nothing was shown in the google maps.
In my HTML, I use:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Any ideas why and how this is gonna work? Thanks a lot for any help!!!
Its been a while since I played with Google maps api, but the map output is html, as in the text is not hardcoded into the image right? You could use jQuery to replace an english name with Thai after it loads. Probably require a 2nd db ajax call to load the Thai, and a if !(a-Z) type check on the map call to use a location id instead of name if you dont have English aliases in your database. If your custom mapping is going to be limited to a small list of locations you could even make a .js location name dictionary file on the initial pageload to cut out repetitive translation ajax calls.