summaryrefslogtreecommitdiff
path: root/locale/escape_special_chars.php
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2013-07-22 07:22:37 +0200
committerBenny Baumann <BenBE@geshi.org>2013-07-22 07:22:37 +0200
commit23ee6915a319bf79b92c494ced798a8c67817ad3 (patch)
tree840c4623882af549d6543307731e50d031dbf2a1 /locale/escape_special_chars.php
parent2e6489775c62b7a0ef4e4bcbb0effc6c12c305a3 (diff)
parent32bec6416a6f6e40b912a707830b6c7385a9a056 (diff)
downloadcacert-devel-23ee6915a319bf79b92c494ced798a8c67817ad3.tar.gz
cacert-devel-23ee6915a319bf79b92c494ced798a8c67817ad3.tar.xz
cacert-devel-23ee6915a319bf79b92c494ced798a8c67817ad3.zip
Merge branch 'bug-893' into bug-1136
Conflicts: includes/temp_functions.php pages/account/43.php
Diffstat (limited to 'locale/escape_special_chars.php')
-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;
}