convert intro and translator names to UTF-8

This commit is contained in:
Nuno Lopes
2005-01-26 17:23:24 +00:00
parent de424d06aa
commit f09bd15c7a

View File

@ -70,7 +70,7 @@ if (!in_array($TYPE, array('php', 'smarty', 'pear'))) {
exit(0); exit(0);
} }
$DOCS = CVS_DIR . get_cvs_dir($TYPE); $DOCS = CVS_DIR . '/' . get_cvs_dir($TYPE);
// $argv was shifted before // $argv was shifted before
$LANGS = $argv; $LANGS = $argv;
@ -171,11 +171,6 @@ function parse_translation($lang)
$txml = join("", file($translation_xml)); $txml = join("", file($translation_xml));
$txml = preg_replace("/\\s+/", " ", $txml); $txml = preg_replace("/\\s+/", " ", $txml);
// Get intro text
if (preg_match("!<intro>(.+)</intro>!s", $txml, $match)) {
$intro = trim($match[1]);
}
// Get encoding for the output, from the translation.xml // Get encoding for the output, from the translation.xml
// file encoding (should be the same as the used encoding // file encoding (should be the same as the used encoding
// in HTML) // in HTML)
@ -185,6 +180,11 @@ function parse_translation($lang)
$charset = $xmlinfo[1]["encoding"]; $charset = $xmlinfo[1]["encoding"];
} }
} }
// Get intro text
if (preg_match("!<intro>(.+)</intro>!s", $txml, $match)) {
$intro = @iconv($charset, 'UTF-8//IGNORE', trim($match[1]));
}
} }
$SQL_BUFF .= "INSERT INTO description VALUES ('$lang', '" . sqlite_escape_string($intro) . "', DATE(), '$charset');\n"; $SQL_BUFF .= "INSERT INTO description VALUES ('$lang', '" . sqlite_escape_string($intro) . "', DATE(), '$charset');\n";
@ -197,7 +197,7 @@ function parse_translation($lang)
foreach ($persons as $person) { foreach ($persons as $person) {
$person = array_merge($default, $person); $person = array_merge($default, $person);
$SQL_BUFF .= "INSERT INTO translators VALUES ('$lang', '" . sqlite_escape_string($person['nick']) . "', '" . sqlite_escape_string($person['name']) . "', '" . sqlite_escape_string($person['email']) . "', '" . sqlite_escape_string($person['cvs']) . "', '" . sqlite_escape_string($person['editor']) . "');\n"; $SQL_BUFF .= "INSERT INTO translators VALUES ('$lang', '" . sqlite_escape_string($person['nick']) . "', '" . sqlite_escape_string(@iconv($charset, 'UTF-8//IGNORE', $person['name'])) . "', '" . sqlite_escape_string($person['email']) . "', '" . sqlite_escape_string($person['cvs']) . "', '" . sqlite_escape_string($person['editor']) . "');\n";
} }
} }