Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] unicode and Perl- how to pass command line unicodearguments
- Date: Wed, 15 Feb 2006 09:03:50 +0100
- From: Gábor Farkas <gabor@example.com>
- Subject: Re: [tlug] unicode and Perl- how to pass command line unicodearguments
- References: <43F12D6F.1020706@example.com> <30ce84360602141624p348b3cacm@example.com><873bilfl15.fsf@example.com>
- User-agent: Mozilla Thunderbird 1.0.7 (X11/20051013)
Stephen J. Turnbull wrote: >>>>>>"Ian" == Ian Wells <ijw@example.com> writes: > > > Ian> Thr reason I was being argumentative with Steve and Python is > Ian> that while I can see that Python has the same problem with > Ian> source code encoding, from what he's saying it seems to take > Ian> the approach that the encoding is set string by string, > Ian> rather than setting for the whole (or remainder of) the file. > Ian> Is that what you meant, Steve? > > No. In Python 2.x, there is a natural language text object, which for > historical reasons is called "Unicode" and whose literals are denoted > u"string". Then there is raw memory, which for historical reasons is > called "string" and whose literals are denoted "string". For > historical reasons, the raw memory object has continued to be heavily > abused as a container of natural language text. What I don't like > about Perl, as I understand your description, is that Perl mandates > that abuse (whatever happened to "there's always more than one way to > do it"? :-) > > As Gabor pointed out, there is a flexible way of making Python as > DWIM-witted as Perl. You can set the encoding for the file in the way > which has become common for many text editors (include Emacsen and > IIRC vim), by putting a specially-formatted comment (aka coding > cookie) at the top of the file. just to avoid any misunderstandings: this coding-cookie only affect the way python treats the unicode text written IN THE GIVEN SOURCE FILE. using something like: #!/usr/bin/python # -*- coding: utf-8 -*- does not mean that all the automatic bytestring=>unicode (and back) conversions will use utf-8. the default charset will still be ascii. gabor
- References:
- Re: [tlug] unicode and Perl- how to pass command line unicodearguments
- From: David Riggs
- Re: [tlug] unicode and Perl- how to pass command line unicodearguments
- From: Ian Wells
- Re: [tlug] unicode and Perl- how to pass command line unicodearguments
- From: Stephen J. Turnbull
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Securing X-Window Protocol
- Next by Date: Re: [tlug] unicode and Perl- how to pass command lineunicodearguments
- Previous by thread: Re: [tlug] unicode and Perl- how to pass command line unicodearguments
- Next by thread: Re: [tlug] unicode and Perl- how to pass command line unicodearguments
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links