Skip to content
Permalink
Browse files

fixed German Umlaut conversion for GNS data; fixes #175

  • Loading branch information...
following5 committed Aug 5, 2015
1 parent c8856cf commit 67a60a1dba44060a4d447e130c2ffa00c6fa28d3
Showing with 30 additions and 14 deletions.
  1. +19 −7 htdocs/lib2/search/search.inc.php
  2. +1 −1 htdocs/search.php
  3. +9 −5 htdocs/util2/gns/gns_import.php
  4. +1 −1 htdocs/util2/gns/mksearchindex.php
@@ -65,7 +65,7 @@ function search_text2simple($str)
return $str;
}
function search_text2sort($str)
function search_text2sort($str, $gns_syntax=false)
{
$str = mb_strtolower($str);
@@ -82,12 +82,24 @@ function search_text2sort($str)
$str = mb_ereg_replace('9', '', $str);
// deutsches
$str = mb_ereg_replace('ä', 'ae', $str);
$str = mb_ereg_replace('ö', 'oe', $str);
$str = mb_ereg_replace('ü', 'ue', $str);
$str = mb_ereg_replace('Ä', 'ae', $str);
$str = mb_ereg_replace('Ö', 'oe', $str);
$str = mb_ereg_replace('Ü', 'ue', $str);
if ($gns_syntax)
{
$str = mb_ereg_replace('ä', 'a', $str);
$str = mb_ereg_replace('ö', 'o', $str);
$str = mb_ereg_replace('ü', 'u', $str);
$str = mb_ereg_replace('Ä', 'a', $str);
$str = mb_ereg_replace('Ö', 'o', $str);
$str = mb_ereg_replace('Ü', 'u', $str);
}
else
{
$str = mb_ereg_replace('ä', 'ae', $str);
$str = mb_ereg_replace('ö', 'oe', $str);
$str = mb_ereg_replace('ü', 'ue', $str);
$str = mb_ereg_replace('Ä', 'ae', $str);
$str = mb_ereg_replace('Ö', 'oe', $str);
$str = mb_ereg_replace('Ü', 'ue', $str);
}
$str = mb_ereg_replace('ß', 'ss', $str);
// akzente usw.
@@ -640,7 +640,7 @@
if ($locid == 0)
{
$ort = $options['ort'];
$simpletexts = search_text2sort($ort);
$simpletexts = search_text2sort($ort,true);
$simpletextsarray = explode_multi($simpletexts, ' -/,');
$sqlhashes = '';
@@ -7,12 +7,16 @@
Dieses Script liest Dateien von GEOnet Names Server (GNS) ein und importiert
diese in die Table gns_locations.
Homepage: http://earth-info.nga.mil/gns/html/
Downloadseite: http://earth-info.nga.mil/gns/html/cntry_files.html
Homepage: http://geonames.nga.mil/gns/html/
Downloadseite: http://geonames.nga.mil/gns/html/namefiles.html
Aktuell eingelesene Dateien:
http://earth-info.nga.mil/gns/html/cntyfile/au.zip
http://earth-info.nga.mil/gns/html/cntyfile/gm.zip
http://earth-info.nga.mil/gns/html/cntyfile/sz.zip
alte Daten von http://earth-info.nga.mil/gns/html/cntry_files.html
Aktuell einzulesende Daten:
http://geonames.nga.mil/gns/html/cntyfile/au.zip
http://geonames.nga.mil/gns/html/cntyfile/gm.zip
http://geonames.nga.mil/gns/html/cntyfile/sz.zip
(Datenformat hat sich geändert, braucht Anpassungen)
***************************************************************************/
// ported from lib1 to lib2 / untested!
@@ -22,7 +22,7 @@
$rs = sql("SELECT `uni`, `full_name_nd` FROM `gns_locations` WHERE `dsg` LIKE 'PPL%'");
while ($r = sql_fetch_array($rs))
{
$simpletexts = search_text2sort($r['full_name_nd']);
$simpletexts = search_text2sort($r['full_name_nd'], true);
$simpletextsarray = explode_multi($simpletexts, ' -/,');
foreach ($simpletextsarray AS $text)

0 comments on commit 67a60a1

Please sign in to comment.
You can’t perform that action at this time.