Reputation: 3352
When choosing UTF-32, for platform dependent endian, libiconv converts correctly but prefixes a 0xfeff BOM to the output stream. This causes some trouble.
When choosing UCS-4, no BOM is written but on my system it converts to 'big endian' which happens to be not the endianness of my system.
Are there any suggestions how to convert to UTF-32/UCS-4 with the platform-dependent endianess without having the remove the BOM manually?
Upvotes: 1
Views: 316
Reputation: 1282
iconv (both the glibc implementation and the GNU libiconv implementation) support encoding names that specify a fixed endianness:
Note that strings in these encodings should better not be transported to other machines, otherwise the lack of a BOM would cause problems.
Upvotes: 0
Reputation: 21249
If you don't specify a byte order, the default is always big endian. To use the byte order of the current platform, use the special UCS-4-INTERNAL
(or UCS-2-INTERNAL
) encoding.
Upvotes: 2