From 2b98ac11ba9c0b30f27533586593f5843c0f74cb Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Wed, 16 Aug 2006 23:42:14 +0000 Subject: [PATCH] Backport git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@816 839d8a87-29fc-0310-9880-83ba4fa771e5 --- include/geoloc.inc.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/geoloc.inc.php b/include/geoloc.inc.php index 133d6ea..77399e5 100644 --- a/include/geoloc.inc.php +++ b/include/geoloc.inc.php @@ -76,7 +76,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']) XDB::execute("REPLACE INTO geoloc_city VALUES ".$infos['sql']); if ($infos['display']) -- 2.1.4