0

I have a problem on my MySQL,

When I save a route with a stress on the name of the route it don't load the markers on map, I'm using utf8

For example, if I write: "á, â, ã, ó, etc..." my markers stop to appear on the map.

PHP Solution: (Only way that worked was use str_replace)

function parseToXML($htmlStr) 
{ 
$xmlStr=str_replace('<','&lt;',$htmlStr); 
$xmlStr=str_replace('>','&gt;',$xmlStr); 
$xmlStr=str_replace('"','&quot;',$xmlStr); 
$xmlStr=str_replace("'",'&#39;',$xmlStr); 
$xmlStr=str_replace("&",'&amp;',$xmlStr); 
$xmlStr = str_replace( 'À', '&#192;', $xmlStr ); 
$xmlStr = str_replace( 'Á', '&#193;', $xmlStr ); 
$xmlStr = str_replace( 'Â', '&#194;', $xmlStr ); 
$xmlStr = str_replace( 'Ã', '&#195;', $xmlStr ); 
$xmlStr = str_replace( 'Ä', '&#196;', $xmlStr ); 
$xmlStr = str_replace( 'Å', '&#197;', $xmlStr ); 
$xmlStr = str_replace( 'Æ', '&#198;', $xmlStr ); 
$xmlStr = str_replace( 'Ç', '&#199;', $xmlStr ); 
$xmlStr = str_replace( 'È', '&#200;', $xmlStr ); 
$xmlStr = str_replace( 'É', '&#201;', $xmlStr ); 
$xmlStr = str_replace( 'Ê', '&#202;', $xmlStr ); 
$xmlStr = str_replace( 'Ë', '&#203;', $xmlStr ); 
$xmlStr = str_replace( 'Ì', '&#204;', $xmlStr ); 
$xmlStr = str_replace( 'Í', '&#205;', $xmlStr ); 
$xmlStr = str_replace( 'Î', '&#206;', $xmlStr ); 
$xmlStr = str_replace( 'Ï', '&#207;', $xmlStr ); 
$xmlStr = str_replace( 'Ð', '&#208;', $xmlStr ); 
$xmlStr = str_replace( 'Ñ', '&#209;', $xmlStr ); 
$xmlStr = str_replace( 'Ò', '&#210;', $xmlStr ); 
$xmlStr = str_replace( 'Ó', '&#211;', $xmlStr ); 
$xmlStr = str_replace( 'Ô', '&#212;', $xmlStr ); 
$xmlStr = str_replace( 'Õ', '&#213;', $xmlStr ); 
$xmlStr = str_replace( 'Ö', '&#214;', $xmlStr ); 
$xmlStr = str_replace( '×', '&#215;', $xmlStr );  // Yeah, I know.  But otherwise the gap is confusing.  --Kris 
$xmlStr = str_replace( 'Ø', '&#216;', $xmlStr ); 
$xmlStr = str_replace( 'Ù', '&#217;', $xmlStr ); 
$xmlStr = str_replace( 'Ú', '&#218;', $xmlStr ); 
$xmlStr = str_replace( 'Û', '&#219;', $xmlStr ); 
$xmlStr = str_replace( 'Ü', '&#220;', $xmlStr ); 
$xmlStr = str_replace( 'Ý', '&#221;', $xmlStr ); 
$xmlStr = str_replace( 'Þ', '&#222;', $xmlStr ); 
$xmlStr = str_replace( 'ß', '&#223;', $xmlStr ); 
$xmlStr = str_replace( 'à', '&#224;', $xmlStr ); 
$xmlStr = str_replace( 'á', '&#225;', $xmlStr ); 
$xmlStr = str_replace( 'â', '&#226;', $xmlStr ); 
$xmlStr = str_replace( 'ã', '&#227;', $xmlStr ); 
$xmlStr = str_replace( 'ä', '&#228;', $xmlStr ); 
$xmlStr = str_replace( 'å', '&#229;', $xmlStr ); 
$xmlStr = str_replace( 'æ', '&#230;', $xmlStr ); 
$xmlStr = str_replace( 'ç', '&#231;', $xmlStr ); 
$xmlStr = str_replace( 'è', '&#232;', $xmlStr ); 
$xmlStr = str_replace( 'é', '&#233;', $xmlStr ); 
$xmlStr = str_replace( 'ê', '&#234;', $xmlStr ); 
$xmlStr = str_replace( 'ë', '&#235;', $xmlStr ); 
$xmlStr = str_replace( 'ì', '&#236;', $xmlStr ); 
$xmlStr = str_replace( 'í', '&#237;', $xmlStr ); 
$xmlStr = str_replace( 'î', '&#238;', $xmlStr ); 
$xmlStr = str_replace( 'ï', '&#239;', $xmlStr ); 
$xmlStr = str_replace( 'ð', '&#240;', $xmlStr ); 
$xmlStr = str_replace( 'ñ', '&#241;', $xmlStr ); 
$xmlStr = str_replace( 'ò', '&#242;', $xmlStr ); 
$xmlStr = str_replace( 'ó', '&#243;', $xmlStr ); 
$xmlStr = str_replace( 'ô', '&#244;', $xmlStr ); 
$xmlStr = str_replace( 'õ', '&#245;', $xmlStr ); 
$xmlStr = str_replace( 'ö', '&#246;', $xmlStr ); 
$xmlStr = str_replace( '÷', '&#247;', $xmlStr );
$xmlStr = str_replace( 'ø', '&#248;', $xmlStr ); 
$xmlStr = str_replace( 'ù', '&#249;', $xmlStr ); 
$xmlStr = str_replace( 'ú', '&#250;', $xmlStr ); 
$xmlStr = str_replace( 'û', '&#251;', $xmlStr ); 
$xmlStr = str_replace( 'ü', '&#252;', $xmlStr ); 
$xmlStr = str_replace( 'ý', '&#253;', $xmlStr ); 
$xmlStr = str_replace( 'þ', '&#254;', $xmlStr ); 
$xmlStr = str_replace( 'ÿ', '&#255;', $xmlStr ); 
return $xmlStr; 
} 

ON MySQL appear the name with stress, the problem is when I load it, the problem is on uft8 or on the PHP ?

enter image description here

geocodezip
  • 158,664
  • 13
  • 220
  • 245
Fred Vicentin
  • 967
  • 3
  • 16
  • 33
  • Use the Character set "pt-BR" for Portuguese. – Harshal Oct 16 '12 at 13:42
  • It is impossible to know when we dont see any code. MySQL, PHP and Google maps v3 kan for sure handle chars with stress, eg Marker { title : 'ááâãó' } – davidkonrad Oct 16 '12 at 13:42
  • see http://stackoverflow.com/questions/3273408/php-mysql-encoding-issues-for-portuguese-pt-br – david strachan Oct 16 '12 at 16:33
  • It might be best if you keep it strictly UTF-8, though. – tadman Oct 16 '12 at 16:50
  • Had put the PHP code too, I'm using varchar and utf-8 and dont work. – Fred Vicentin Oct 17 '12 at 17:05
  • Your solution duplicates the job of the `htmlentities` PHP function, though poorly (what about Unicode characters above U+00FF?). MySQL, PHP and Google Maps have no problems with UTF-8 text, so a better solution would be finding out which link of the chain is broken. – Joni Oct 21 '12 at 14:14

0 Answers0