<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Aug 24, 2015 at 9:10 AM, Ben Boeckel <span dir="ltr"><<a href="mailto:ben.boeckel@kitware.com" target="_blank">ben.boeckel@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Aug 24, 2015 at 08:48:54 -0600, David Gobbi wrote:<br>
> On Windows, kwsys and most IO classes still do filesystem operations using<br>
> the local 8-bit encoding.  Which is silly, I know, considering that Windows<br>
> provided unicode APIs 22 years ago. But I don't see anyone volunteering to<br>
> fix this, which means that, right now, some people will have to use<br>
> encodings other than utf-8 for their filenames.<br>
<br>
</span>FWIW, POSIX filenames are arbitrary bytestrings, so it's not<br>
*technically* different there either. And there's no indication or place<br>
to query what encoding should be used either since it's more a property<br>
of the one who wrote the file than the one who is reading it (so LANG<br>
might not help).<br></blockquote><div><br></div><div>It's quite different.  At the file-system level, Windows always uses UTF-16.</div><div>So on Windows, if you always use the unicode (wide char) APIs, then as a</div><div>developer you are always safe.  The user can't screw you up by switching</div><div>the code page.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In any case, won't just handing over raw bytes for invalid utf-8<br>
sequences be fine at that point (if we tried to normalize, I could see a<br>
problem though)?</blockquote><div><br></div><div>That's my gut feeling.  And we won't normalize (in the wrappers) because</div><div>that would screw things up.  Thankfully, the python encoders/decoders don't</div><div>normalize, either, so round-trip conversions between utf-8 and unicode works.</div><div><br></div><div>Normalization can definitely be an issue with filenames, however, because</div><div>1) OS X uses NFD, 2) Windows prefers NFC, 3) POSIX doesn't care.</div><div>I was quite surprised the first time I did a non-ascii directory listing in</div><div>OS X, and the accented characters were decomposed.</div><div><br></div><div> - David</div><div> </div></div><br></div></div>