View Full Version : multi-byte format

01-06-2006, 06:56 AM

I need to convert å plaintext string into a multi-byte storage format. The ASCII characters have should have the high byte set to 0x00.

How to do this in PHP? Any suggestions?

Velox Letum
01-06-2006, 08:56 AM
utf8_encode() (http://www.php.net/function.utf8-encode)

Note: this is to convert from ISO-8859-1 to UTF-8. If you need to convert from another charset, use recode_string() (http://www.php.net/function.recode-string) or iconv(). Personally, I recommend iconv() (http://www.php.net/function.iconv) if you require a function beyond utf8_encode().

01-06-2006, 10:23 AM
This helped me a bit further.

Then, to set the high byte to 0x00 for ascii values, I simply add 00 to the hex-string i get when using bin2hex($ascii_value)? I'm not completely sure, so I'm thankful for any help.