I encode a binary file with data structures where one of the property is of wchar_t type for UTF-8 support.
Each struct looks like this:
struct DataBlock{
wchar_t charcode;
int width;
int height;
///etc
}
The encoding happens on Windows where wchar_t size is 2 bytes.
The decoding of the file happens on Linux where the size is 4 bytes.So the read out values for charcode are wrong on the Linux side.
What is the best way to fix that difference without usage of 3rd party libs for UTF?Is it ok to encode charcode,for example into 'int' data type on win and then on Linux cast it to wchar_t?
Aucun commentaire:
Enregistrer un commentaire