unicode,utf-8,ucs2 :(
Moderator: General Moderators
unicode,utf-8,ucs2 :(
hi all,
90b17ff06587 <- this is chinese character.
I would like to convert the above to : %C2%B1%C3%B0%C2%87
any ideas?
TIA
90b17ff06587 <- this is chinese character.
I would like to convert the above to : %C2%B1%C3%B0%C2%87
any ideas?
TIA
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
簣簸 are the 2 characters..newbiee wrote:hi feyd,feyd wrote:that creates 2 chinese characters for me, once I switch character sets...
i persume this is the chinese characters you get : ±ð‡ but if you would to convert the : 90b17ff06587 , the output is not the same. anyway thanks alot for helping out.
If the byte stream you are getting is 16-bit unicode, they'll be:
邱翰文
which when run through a browser, produced 3 chinese characters.
Note: I converted the byte stream as big endian 16bit unicode.
feyd wrote:簣簸 are the 2 characters..newbiee wrote:hi feyd,feyd wrote:that creates 2 chinese characters for me, once I switch character sets...
i persume this is the chinese characters you get : ±ð‡ but if you would to convert the : 90b17ff06587 , the output is not the same. anyway thanks alot for helping out.
If the byte stream you are getting is 16-bit unicode, they'll be:
邱翰文
which when run through a browser, produced 3 chinese characters.
Note: I converted the byte stream as big endian 16bit unicode.
hi feyd,
thanks a lot for taking u time helping out, do you mind sharing your code.
TIA
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I didn't use code to convert them I just hand (sorta) converted them to their integer values..
if it's big endian, 16bit unicode:untested
if it's big endian, 16bit unicode:
Code: Select all
<?php
$stream = '90b17ff06587';
$characters = preg_split('#([0-9a-f]{4})#i',$stream,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
foreach($characters as $k => $v)
{
$characters[$k] = '&' . hexdec($v) . ';';
}
echo implode('',$characters);
?>