<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>On Windows, the Wide APIs are already used throughout the code base,<br>


</div>
e.g. SetEnvironmentVariableW/_wenviron. If you need to find out the<br>
specific API for a specific functionality, please read the source code.  [...]<br></blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


No, I don&#39;t assume that. I assume that all functions are strictly<br>
available in a Wide character version, and have verified that they are.</blockquote><div> <br>The wide APIs use UTF-16.  UTF-16 suffers from the same problem as UTF-8: not all sequences of words are valid UTF-16 sequences.  In particular, sequences containing isolated surrogate pairs are not well-formed according to the Unicode standard.  Therefore, the existence of a wide character API function does not guarantee that the wide character strings it returns can be converted into valid unicode strings.  And, in fact, Windows Vista happily creates files with malformed UTF-16 encodings, and os.listdir() happily returns them. <br>


 <br></div>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">If you can crash Python that way,<br>
nothing gets worse by this PEP - you can then *already* crash Python<br>
in that way.</blockquote><div><br>Yes, but AFAIK, Python does not currently have functions that, as part of correct usage and normal operation, are intended to generate malformed unicode strings.  <br><br>Under your proposal, passing the output from a correctly implemented file system or other OS function to a correctly written library using unicode strings may crash Python.  In order to avoid that, every library that&#39;s built into Python would have to be checked and updated to deal with both the Unicode standard and your extension to it.<br>


<br>Tom<br><br></div></div>