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:
char c = (char)myInteger;
Is this safe?
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:
char c = (char)myInteger;
Is this safe?
Copyright © 2021 Jogjafile Inc.
Yes, as long as there are no byte-ordering issues this should be fine.