Is there any conceivable reason why I would see different results using unicode string literals versus the actual hex value for the UChar.
UnicodeString s1(0x0040); // @ sign
UnicodeString s2("\u0040");
s1 isn’t equivalent to s2. Why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The \u escape sequence AFAIK is implementation defined, so it’s hard to say why they are not equivalent without knowing details on your particular compiler. That said, it’s simply not a safe way of doing things.
UnicodeString has a constructor taking a UChar and one for UChar32. I’d be explicit when using them:
UnicodeString also provide an unescape() method that’s fairly handy: