user_iv
user_iv

Reputation: 143

UCS2 and unicode C and mysql

I'm writing an application where I receive a char from network, for example char "ص" and I have the same char saved in DB from a PHP page, I can see that the char in DB is saved like this 0xd8b5 but the one I receive from network is like 0x0635. How can I change either of them to the other for comparison purposes?

I'm trying to understand the difference between ucs2 and utf16, what is the relationship between these two?

Upvotes: 0

Views: 123

Answers (1)

chux
chux

Reputation: 153338

When you see the char "ص" in DB as 0xd8b5, it is in UTF8 encoding. When you see 0x0635, it is in UTF16 encoding. I believe the UCS2 encoding would also be 0x0635. Thus you have a UTF8 versus UTF16 situation, not a UCS2 versus UTF16.

Upvotes: 1

Related Questions