3
* iso-8859-9 encoding functions
5
* takes a string of unicode entities and converts it to a iso-8859-9 encoded string
6
* Unsupported characters are replaced with ?.
8
* @version $Id: iso_8859_9.php,v 1.2.2.2 2004/12/27 15:03:47 kink Exp $
9
* @copyright Copyright © 2004-2004 The SquirrelMail Project Team
10
* @package squirrelmail
15
* Converts string to iso-8859-9
16
* @param string $string text with numeric unicode entities
17
* @return string iso-8859-9 encoded text
19
function charset_encode_iso_8859_9 ($string) {
20
// don't run encoding function, if there is no encoded characters
21
if (! preg_match("'&#[0-9]+;'",$string) ) return $string;
23
$string=preg_replace("/&#([0-9]+);/e","unicodetoiso88599('\\1')",$string);
24
// $string=preg_replace("/&#[xX]([0-9A-F]+);/e","unicodetoiso88599(hexdec('\\1'))",$string);
30
* Return iso-8859-9 symbol when unicode character number is provided
32
* This function is used internally by charset_encode_iso_8859_9
33
* function. It might be unavailable to other squirrelmail functions.
34
* Don't use it or make sure, that functions/encode/iso_8859_9.php is
37
* @param int $var decimal unicode value
38
* @return string iso-8859-9 character
40
function unicodetoiso88599($var) {
42
$iso88599chars=array('160' => "\xA0",
140
if (array_key_exists($var,$iso88599chars)) {
141
$ret=$iso88599chars[$var];
b'\\ No newline at end of file'