curl-library
Re: encoding of file:// URL on Windows
Date: Fri, 08 Aug 2014 11:48:32 -0600
On Friday, August 08, 2014 07:39:06 PM Dan Fandrich wrote:
> On Fri, Aug 08, 2014 at 07:00:48PM +0200, Pierre Joye wrote:
> > On Aug 7, 2014 4:17 PM, <clinton_at_elemtech.com> wrote:
> > > What encoding does libcurl expect from the caller when setting the
> >
> > CURLOPT_URL option? UTF-8 or the Windows ANSI code page?
> >
> > > The answer to that would help make a correct patch.
> >
> > As far as I remember no specific encoding are expected as *nix just take
> > everything they get.
> >
> > I would suggest to implement it to expect UTF-8 on Windows and use the *W
> > APIs, converting UTF-8 to wchar before.
>
> Wouldn't it make more sense to expect the encoding of the current code page?
> If someone cuts and pastes an i18n URL into the command-line for example,
> treating that unconditionally as UTF-8 would be wrong, IIUC.
>
Sure, the command line can and should use the current code page. But that
could be converted to UTF-8 before calling the library API.
Either the library API is expanded to accept wide strings, or the current API
takes UTF-8. Is there a preference?
Regardless of the API, in the implementation, a wide string should be used to
call _wopen().
Clinton
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-08-08