<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><div><div style="font-family: Calibri,sans-serif; font-size: 11pt;">The last point is correct: if you get bytes from a file system API, you should be able to pass them back in without losing information. CP_ACP (a.k.a. the *A API) does not allow this, so I'm proposing using the *W API everywhere and encoding to utf-8 when the user wants/gives bytes.<br><br>Top-posted from my Windows Phone</div></div><div dir="ltr"><hr><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">From: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:turnbull.stephen.fw@u.tsukuba.ac.jp">Stephen J. Turnbull</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Sent: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">8/13/2016 12:11</span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">To: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:random832@fastmail.com">Random832</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Cc: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:python-ideas@python.org">python-ideas@python.org</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Subject: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">Re: [Python-ideas] Fix default encodings on Windows</span><br><br></div>Random832 writes:<br><br> > And what's going to happen if you shovel those bytes into the<br> > filesystem without conversion on Linux, or worse, OSX?<br><br>Off topic. See Subject: field.<br><br> > This proposal embodies an assumption that bytes from unknown sources<br> > used as filenames are more likely to be UTF-8 than in the locale ACP<br><br>Then it's irrelevant: most bytes are not from "unknown sources",<br>they're from correspondents (or from yourself!) -- and for most users<br>most of the time, those correspondents share the locale encoding with<br>them. At least where I live, they use that encoding frequently.<br><br> > the only solution is to require the application to make a<br> > considered decision<br><br>That's not a solution. Code is not written with every decision<br>considered, and it never will be. The (long-run) solution is a la<br>Henry Ford: "you can encode text any way you want, as long as it's<br>UTF-8". Then it won't matter if people ever make considered decisions<br>about encoding! But trying to enforce that instead of letting it<br>evolve naturally (as it is doing) will cause unnecessary pain for<br>Python programmers, and I believe quite a lot of pain.<br><br>I used to be in the "make them speak UTF-8" camp. But in the 15 years<br>since PEP 263, experience has shown me that mostly it doesn't matter,<br>and that when it does matter, you have to deal with the large variety<br>of encodings anyway -- assuming UTF-8 is not a win. For use cases<br>that can be encoding-agnostic because all cooperating participants<br>share a locale encoding, making them explicitly specify the locale<br>encoding is just a matter of "misery loves company". Please, let's<br>not do things for that reason.<br><br> > I think the use case that the proposal has in mind is a<br> > file-names-are-just-bytes program (or set of programs) that reads<br> > from the filesystem, converts to bytes for a file/network, and then<br> > eventually does the reverse - either end may be on windows.<br><br>You have misspoken somewhere. The programs under discussion do not<br>"convert" input to bytes; they *receive* bytes, either from POSIX APIs<br>or from Windows *A APIs, and use them as is. Unless I am greatly<br>mistaken, Steve simply wants that to work as well on Windows as on<br>POSIX platforms, so that POSIX programmers who do encoding-agnostic<br>programming have one less barrier to supporting their software on<br>Windows. But you'll have to ask Steve to rule on that.<br><br>Steve<br>_______________________________________________<br>Python-ideas mailing list<br>Python-ideas@python.org<br>https://mail.python.org/mailman/listinfo/python-ideas<br>Code of Conduct: http://python.org/psf/codeofconduct/<br></body></html>