Lars Gullik Bjønnes wrote: > Is this really what we want? > (The answer from my pov is "NO") > > IMHO we want to use native endianess internally, and I do not get why > anything should care about what we do internally.
The patch does not alter how iconv is called: UCS-4 == UCS-4BE, regardless of the native endianness. UCS-4 != USC-4INTERNAL (when USC-4INTERNAL exists at all). Outside of unicode.C we always have native endianness, but inside unicode.C we alwasy get BE from iconv and convert to native endianness in the callers. You did that already for ucs4 and little endian, but did not do that for ucs2, so the ucs4 conversion was wrong on big endian machines, and the ucs2 conversion was wrong on little endian machines. We could as well do #ifdef WORDS_BIGENDIAN call iconv with BE #else call iconv with LE #endif and do no conversion with the copying, but since the copying will be optimized away anyway and it is not completely sure yet that we will even use iconv I did not think too much about this and simply changed the code as little as possible. I would suggest to come back to this when the unicode conversion is optimized. Georg