Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > On u'Unicode string literals' (Py3)

Reply
Thread Tools

On u'Unicode string literals' (Py3)

 
 
jmfauth
Guest
Posts: n/a
 
      02-29-2012
For those who do not know:
The u'' string literal trick has never worked in Python 2.

>>> sys.version

'2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]'
>>> print u'Un oeuf zro EURO uro'

Un uf zro uro
>>>


jmf
 
Reply With Quote
 
 
 
 
Dave Angel
Guest
Posts: n/a
 
      02-29-2012
Just who are you replying to?

On 02/29/2012 08:45 AM, jmfauth wrote:
> For those who do not know:
> The u'' string literal trick has never worked in Python 2.
>


No trick there. If you have something explicit to say, then say it.
>>>> sys.version

> '2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]'


Why then does the subject line say Py3 ?

>>>> print u'Un oeuf zro EURO uro'


You're testing three things here, so there's no telling which might be
wrong. Your source encoding, the implicit str() conversion for unicode,
and the particular terminal you're printing it on. It'd be amazing if
all three were right, unless you're on Linux.

> Un uf zro uro
> jmf



--

DaveA

 
Reply With Quote
 
 
 
 
jmfauth
Guest
Posts: n/a
 
      02-29-2012
On 29 fv, 14:45, jmfauth <(E-Mail Removed)> wrote:
> For those who do not know:
> The u'' string literal trick has never worked in Python 2.
>
> >>> sys.version

>
> '2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]'>>> print u'Un oeuf zro EURO uro'
>
> Un *uf zro *uro
>
>
>
> jmf



Sorry, I just wanted to show a small example.
I semms Google as "changed" again.

You should read (2nd attempt)
u'Un uf zro ' with the *correct* typed glyphs 'LATIN SMALL
LIGATURE OE'
in uf and 'EURO SIGN' in 'uro'.

jmf
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
'System.String[]' from its string representation 'String[] Array' =?Utf-8?B?UmFqZXNoIHNvbmk=?= ASP .Net 0 05-04-2006 04:29 PM
Is "String s = "abc";" equal to "String s = new String("abc");"? Bruce Sam Java 15 11-19-2004 06:03 PM
String[] files = {"a.doc, b.doc"}; VERSUS String[] files = new String[] {"a.doc, b.doc"}; Matt Java 3 09-17-2004 10:28 PM
String.replaceAll(String regex, String replacement) question Mladen Adamovic Java 3 12-05-2003 04:20 PM
Re: String.replaceAll(String regex, String replacement) question Mladen Adamovic Java 0 12-04-2003 04:40 PM



Advertisments