A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/020998.html below:

[Python-Dev] PEP 263 considered faulty (for some Japanese)

[Python-Dev] PEP 263 considered faulty (for some Japanese) [Python-Dev] PEP 263 considered faulty (for some Japanese)Martin v. Loewis martin@v.loewis.de
12 Mar 2002 20:57:13 +0100
SUZUKI Hisao <suzuki611@oki.com> writes:

> What we handle in Unicode with Python is often a document file
> in UTF-16.  The default encoding is mainly applied to data from
> the document.  

You should not use the default encoding for reading files. Instead,
you should use codecs.open or some such to read in UTF-16 data.

> Yes, I mean such things.  Please note that u'<whatever-in-ascii>' is
> interpreted just literally and we cannot put Japanese characters in
> string literals legally for now anyway.

One of the primary rationale of the PEP is that you will be able to
put arbitrary Japanese characters into u'<whatever-in-euc-jp', and
have it work correctly.

> >>> unicode("\x00a\x00b\x00c")
> u'abc'

You should use

  unicode("\x00a\x00b\x00c", "utf-16")

instead.

Regards,
Martin



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4