summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tänzer <neo@nhng.de>2012-09-13 18:49:22 +0200
committerMichael Tänzer <neo@nhng.de>2012-09-13 18:49:22 +0200
commitc25bf27b661c9c303ad76d3e9789a794b25179ee (patch)
tree3a71310045f806499cb2355d54a039e2b0711960
parent31fe41cd72d1a7d34a98cac8cf9122874ad07b2f (diff)
downloadcacert-devel-c25bf27b661c9c303ad76d3e9789a794b25179ee.tar.gz
cacert-devel-c25bf27b661c9c303ad76d3e9789a794b25179ee.tar.xz
cacert-devel-c25bf27b661c9c303ad76d3e9789a794b25179ee.zip
bug 1097: Also escape characters outside the ASCII rangebug-1097
Signed-off-by: Michael Tänzer <neo@nhng.de>
-rw-r--r--locale/escape_special_chars.php9
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
+ // &gt; or &auml; 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;
}