KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to get the UCS-2 code points for a given UTF-8 string. For example the word "hello" should become something like "0068 0065 006C 006C 006F". Please note that the characters could be from any language including complex scripts like the east asian languages. So, the problem comes down to "convert a given character to its UCS-2 code point" But how? Please, any kind of help will be very very much appreciated since I am in a great hurry. Transcription of questioner's response posted as an answer Thanks for your reply, but it needs to be done in PHP v 4 or 5 but not 6. The string will be a user input, from a form field. I want to implement a PHP version of utf8to16 or utf8decode like function get_ucs2_codepoint($char) { // calculation of ucs2 codepoint value and assign it to $hex_codepoint return $hex_codepoint; } Can you help me with PHP or can it be done with PHP with version mentioned above?
Tags (comma-separated)
Save Edits
Cancel