cURL Mailing List Monthly Index Single Mail
Re: Building libcurl on MS-Windows with UNICODE defined
From: Tom Bishop, Wenlin Institute <tangmu_at_wenlin.com>
Date: Tue, 1 Nov 2011 11:53:45 -0700
On Oct 15, 2011, at 2:57 PM, Daniel Stenberg wrote:
> On Mon, 10 Oct 2011, Tom Bishop, Wenlin Institute wrote:
Please excuse the lateness of this reply. I agree this does not appear to be a critical issue and I understand that a new version is coming soon, so I don't suggest making any immediate changes. I'm not aware of any problem with the current code, provided that it's built with the makefile (with UNICODE not defined), and assuming that user-names, etc., passed to these MS-Windows functions, are always ASCII in actual current usage (probably true since nobody has complained).
> But if we can fix problems by altering the code, and not cause backwards compatible problems, then I'm all for it!
Thank you! When I have more time to spare I'd like to study it further and possibly make some suggestions. The only change I'd suggest testing after the next version is to replace FormatMessage(), etc., with FormatMessageA(), etc., so that the code will compile and run correctly (for code points < U+0080) regardless of whether UNICODE is defined, for the benefit of people who compile CURL with different makefiles. (I've done that already in my own copy, and it compiles without warnings, but so far I'm using only a tiny part of CURL's functionality so I can't say it's well-tested. Still, the logic is simple: if UNICODE is not defined, then FormatMessage is defined as FormatMessageA anyway, so the replacement has no effect. If UNICODE is defined, then FormatMessage is defined as FormatMessageW, and it triggers a compiler warning and run-time failure if called with "char *". Therefore it's better to use the name FormatMessageA explicitly, as long as you're calling it with "char *".)
Probably there are also potential improvements that would use the Unicode-capable versions of the MS-Windows functions, possibly supporting UTF-8 strings that get converted to UTF-16 so that CURL's API can still use "char *" but non-ASCII characters will get passed correctly to the MS-Windows functions.
文林 Wenlin Institute, Inc. Software for Learning Chinese
These mail archives are generated by hypermail.
Page updated November 12, 2010.
web site info