Looking for an appropriate encoding standard that supports all languages

Rami Chowdhury rami.chowdhury at merton.oxon.org
Fri Aug 20 12:07:21 EDT 2010


On Fri, Aug 20, 2010 at 21:02, ata.jaf <a.j.romanista at gmail.com> wrote:
> On Aug 19, 11:48 am, Steven D'Aprano <steve-REMOVE-
> T... at cybersource.com.au> wrote:
>> On Thu, 19 Aug 2010 01:29:51 -0700, ata.jaf wrote:
>> > On Aug 17, 11:55 pm, Thomas Jollans <tho... at jollybox.de> wrote:
>> >> On Tuesday 17 August 2010, it occurred to ata.jaf to exclaim:
>>
>> >> > I am developing a little program in Mac with wxPython. But I have
>> >> > problems with the characters that are not in ASCII. Like some special
>> >> > characters in French or Turkish. So I am looking for a way to solve
>> >> > this. Like an encoding standard that supports all languages. Or some
>> >> > other way.
>>
>> >> Anything that supports all of Unicode will do. Like UTF-8. If your text
>> >> is mostly Latin, then just go for UTF-8, if you use other alphabets
>> >> extensively, you might want to consider UTF-16, which might the use a
>> >> little less space.
>>
>> > OK, I used UTF-8.
>> > I write a line of strings in the source code
>>
>> Do you have a source code encoding line at the start of your script?
>>
>> http://www.python.org/dev/peps/pep-0263/
>>
>
> Yes I have a source code encoding line.
> Here it is:
>
> # -*- coding: utf_16 -*-
>
> I am using WxPython.
>
> And the error that I get about using utf-16 is:\
>
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "z.py", line 2
> SyntaxError: UTF-16 stream does not start with BOM

Which encoding are you saving your script in? Very few of the text
editors I've used save to UTF-16 by default.

-- 
Rami Chowdhury
"Never assume malice when stupidity will suffice." -- Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)



More information about the Python-list mailing list