Fixed charset encoding bug (#1484429)
| | |
| | | |
| | | 2007/09/09 (thomasb) |
| | | ---------- |
| | | - Fixed charset encoding bug (#1484429) |
| | | - Applied patch for LDAP version (#1484552) |
| | | - Improved XHTML validation |
| | | |
| | |
| | | if (!$enctype) |
| | | $enctype = $GLOBALS['OUTPUT_TYPE']; |
| | | |
| | | // convert nbsps back to normal spaces if not html |
| | | if ($enctype!='html') |
| | | $str = str_replace(chr(160), ' ', $str); |
| | | |
| | | // encode for plaintext |
| | | if ($enctype=='text') |
| | | return str_replace("\r\n", "\n", $mode=='remove' ? strip_tags($str) : $str); |
| | |
| | | |
| | | for ($c=160; $c<256; $c++) // can be increased to support more charsets |
| | | { |
| | | $hex = dechex($c); |
| | | $xml_rep_table[Chr($c)] = "&#$c;"; |
| | | |
| | | if ($OUTPUT->get_charset()=='ISO-8859-1') |
| | | $js_rep_table[Chr($c)] = sprintf("\u%s%s", str_repeat('0', 4-strlen($hex)), $hex); |
| | | $js_rep_table[Chr($c)] = sprintf("\\u%04x", $c); |
| | | } |
| | | |
| | | $xml_rep_table['"'] = '"'; |