Jump to content
  • Advertisement
Sign in to follow this  
TelevirtualSoftDev

A quick UNICODE puzzle

This topic is 4386 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I need to make a UTF-16 wide character string to read into an API string. Into my program comes a UTF-16 encoded escape sequence (i.e \u30e5\u30d2\u3026). At the moment I am... 1) parsing this string removing the numbers and converting them to decimal. 2)Placing the decmial sting into an unsigned int array. 3) Reading the int Array into a wchar_t array using only '=' with an iteration 4) adding a terminating character i.e. charStore[finalPosition] = L'\0'. 5) Passing a pointer to this string to an API which requires UTF-16. It takes the string but produces incorrect results. Can this be done? Where am I going wrong (method wise, i'll sort out the efficiency and use of string class later if needed)? thanks

Share this post


Link to post
Share on other sites
Advertisement

It does work - maybe not for all cases, i havn't tested yet. ( i needed to set something in the API i am using)

I'd have a look at the method if you ever need to use it though. It could probably be done far more efficiently.

If anyone does know a c++ command that does this quicker feel free to show me up.

Share this post


Link to post
Share on other sites
Does your "UTF-16" API really require a wchar_t? The same wchar_t as the rest of your program? Is wchar_t 16 or 32 bits? If it is 16 bits, does it choke on surrogate pairs? What are you doing with generic unsigned ints, considering that you need exactly 16 and/or 32 bit unsigned values? What characters are processed correctly and incorrectly, and how are they mangled?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!