Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19561

Re: to express unicode string

From Terry Reedy <tjreedy@udel.edu>
Subject Re: to express unicode string
Date 2012-01-28 18:03 -0500
References <CA+YdQ_7iy9z1=o10qsQr+y9Cx_wiCLjiTyZc8PsfF7iEQ+t=Fw@mail.gmail.com> <4F245367.1010902@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5184.1327792744.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 1/28/2012 2:58 PM, Michael Torrie wrote:
> On 01/28/2012 12:21 AM, contro opinion wrote:
>>>>> s='你好'
>
> On my computer, s is a byte string that contains the utf-8 formatted
> encoding of 你好.

On mine, s is a (unicode) string containing those two characters. That 
is because I pasted the above into IDLE 3.2.2 (on Win7, but should be 
the same on all systems). (Pasting into the standard interpreter window, 
which uses Windows stupid Command Prompt interface, does not work.)

To the OP. if you want to work easily with unicode, use Python 3.2 now 
and Python 3.3 as soon as it comes out, in less than a year. We went 
through the hassle of changing the string type from bytes to unicode 
*because* having unicode as merely an add-on type was not working very well.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: to express unicode string Terry Reedy <tjreedy@udel.edu> - 2012-01-28 18:03 -0500

csiph-web