[Zlib-devel] zlib gzopen_w function added
Jan Seiffert
kaffeemonster at googlemail.com
Sat Mar 17 13:01:40 EDT 2012
2012/3/17 Mark Adler <madler at madler.net>:
> On Mar 17, 2012, at 9:08 AM, Jan Seiffert wrote:
>> And to include an UTF-8 to UTF-16 transform in the normal func... no,
>> would break code which expects the handling as is.
>
> Jan,
>
> That is exactly what I was concerned about in the first approach (always do a UTF-8 to UTF-16 conversion in gzopen when on Windows), hence why I tried to duplicate what appears to be the standard approach in Windows. However I don't know enough to know what actual problems might occur. What specifically might break in that scenario?
How do you cleanly detect UTF-8 without confusing it with any other
8-bit codepage, like latin1 (and other) for non windows systems and
the slew of CP85*/CP125* (and other) for windows.
That is the problem.
Or: As long as a user uses the system codepage and is fine with it and
stays within it's bounds it already works for him ATM. If i have a
Windows with CP1250 i can pass an 8-Bit string with umlauts and other
stuff in this codepage things work for me, even using the *A
functions. Sneaking in a wrong codepage conversion may break it for
them.
The *A windows API func already does the conversion from the system
codepage. While it is all very confusing, at least there is some
defined way how they do things, you can always point to the WIN-API on
how things are handled.
IMHO the only sane thing is to pass things on as they are.
You can do it by hand with MultiByteToWideChar using CP_OEMCP and
always call the *W function, but you gain nothing, and UTF-8 still
does not work.
What you loose is support for pre *W Windows version like Win95-Win98
(Yes, they are deprecated, but as long as the code could work, no
reason to throw a wrench into someones gears who is stuck with these
systems for whatever reason (often very old proprietary code, for
example some old DOS program to read machine data which bang directly
on the IO-ports to access the RS232 port and such fun things)).
>
> Mark
>
Greetings
Jan
--
˙qɐɥ ʇɟnɐʞǝƃ ʎɐqǝ ıǝq ɹnʇɐʇsɐʇ ǝuıǝ ɹıɯ ɥɔı sɐp lɐɯ ǝʇzʇǝl sɐp ʇsı sɐp
'ʇɯɯɐpɹǝʌ
More information about the Zlib-devel
mailing list