开发者

How do I convert a 16-bit UCS-2 integer value into a char?

开发者 https://www.devze.com 2023-02-12 08:48 出处:网络
I am parsing values from a binary file. One value I am parsing is a 16-bit number which represents the UCS-2 encoding of a unicode character. I\'m converting it to a character like this:

I am parsing values from a binary file. One value I am parsing is a 16-bit number which represents the UCS-2 encoding of a unicode character. I'm converting it to a character like this:

cha开发者_C百科r c = (char)myInteger;

Is this safe?


Yes, as long as there are no byte-ordering issues this should be fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消