diff options
author | Benny Baumann <BenBE@geshi.org> | 2013-01-16 02:59:02 +0100 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2013-01-16 02:59:02 +0100 |
commit | 98c12d454741464082bfa11b746954b38dfac942 (patch) | |
tree | b5c1a523425f57402f9dfe4e43352f610408201a | |
parent | d92573a703a521b92a5b64a16db72025b7882e32 (diff) | |
parent | c25bf27b661c9c303ad76d3e9789a794b25179ee (diff) | |
download | cacert-devel-98c12d454741464082bfa11b746954b38dfac942.tar.gz cacert-devel-98c12d454741464082bfa11b746954b38dfac942.tar.xz cacert-devel-98c12d454741464082bfa11b746954b38dfac942.zip |
Merge branch 'bug-1097' into release
-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; } |