diff options
author | Michael Tänzer <neo@nhng.de> | 2013-02-13 00:00:20 +0100 |
---|---|---|
committer | Michael Tänzer <neo@nhng.de> | 2013-02-13 00:00:20 +0100 |
commit | f7484beb1ecc6d7d8cf8d31eee792bd4ba540aec (patch) | |
tree | 7dc4cf61bbb5c204875910c33680fc69392ce542 /locale | |
parent | 861aaeff82307087364e397d9b9256cb74c04ca1 (diff) | |
download | cacert-devel-f7484beb1ecc6d7d8cf8d31eee792bd4ba540aec.tar.gz cacert-devel-f7484beb1ecc6d7d8cf8d31eee792bd4ba540aec.tar.xz cacert-devel-f7484beb1ecc6d7d8cf8d31eee792bd4ba540aec.zip |
Source code taken from cacert-20130129.tar.bz2
Diffstat (limited to 'locale')
-rw-r--r-- | locale/escape_special_chars.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/locale/escape_special_chars.php b/locale/escape_special_chars.php index 32de390..0f494f1 100644 --- a/locale/escape_special_chars.php +++ b/locale/escape_special_chars.php @@ -41,6 +41,9 @@ function is_msgid($line) { return substr_compare($line, MSGID, 0, MSGID_LEN) === 0; } + +////////////// Main ////////////// + // Skip the metadata (first msgid/msgstr pair) while (!feof(STDIN)) { $line = fgets(STDIN); @@ -65,7 +68,13 @@ while (!feof(STDIN)) { } if ($msgstr) { + // Escape everything that has a special HTML entity such as + // > or ä except quote characters $line = htmlentities($line, ENT_NOQUOTES, "UTF-8"); + + // Escape everything else -> all characters that don't have a special + // HTML entity but are outside the ASCII range + $line = mb_convert_encoding($line, "HTML-ENTITIES", "UTF-8"); } echo $line; } |