From: x2003bruneau Date: Wed, 16 Aug 2006 23:41:48 +0000 (+0000) Subject: Fix issues with adresse encoding (see Ticket #2006081710000031) X-Git-Tag: xorg/0.9.10~3 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=656bb3789446a50167b72b62c3156ed60619b0fb;p=platal.git Fix issues with adresse encoding (see Ticket #2006081710000031) git-svn-id: svn+ssh://murphy/home/svn/platal/branches/platal-0.9.10@815 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/include/geoloc.inc.php b/include/geoloc.inc.php index a8d2c08..37d6183 100644 --- a/include/geoloc.inc.php +++ b/include/geoloc.inc.php @@ -79,7 +79,16 @@ function get_address_infos($txt) { $keys = explode('|',fgets($f)); $vals = explode('|',fgets($f)); $infos = array(); - foreach ($keys as $i=>$key) if($vals[$i]) $infos[$key] = ($key == 'sql')?$vals[$i]:utf8_decode(strtr($vals[$i], array(chr(197).chr(147) => "œ"))); + foreach ($keys as $i=>$key) { + if($vals[$i]) { + if ($key == 'sql') { + $infos[$key] = $vals[$i]; + } else { + $val = strtr($vals[$i], array(chr(197).chr(147) => "œ")); + $infos[$key] = (iconv('utf-8', 'utf-8', $val) == $val) ? utf8_decode($val) : $val; + } + } + } if ($infos['sql']) $globals->xdb->execute("REPLACE INTO geoloc_city VALUES ".$infos['sql']); if ($infos['display'])