[Tutor] Problems with encodings
Michael Lange
klappnase at freenet.de
Mon Apr 18 11:03:03 CEST 2005
On Mon, 18 Apr 2005 09:22:28 +0300
Olli Rajala <olli.rajala at gmail.com> wrote:
> Hi!
> Been offlist for a while, but now I started to code an administration
> tool for my own photo gallery and have some troubles, so thought to
> write and ask some help. :)
>
> So, I'm from Finland and I'm using ISO-8859-15 -encoding but Python
> don't "understand" letters outside ASCII. I've read PEP-0263 and tried
> to add the encoding line to my sources, but it doesn't help. Here's a
> little example:
>
> #!/usr/bin/python2.4
> # -*- coding: <iso-8859-15> -*-
> def printHeader():
> print "ääää"
>
> Don't know how you see the 4th line, but that's not my "problem", is it? ;)
>
> And I got this error message:
> "sys:1: DeprecationWarning: Non-ASCII character '\xe4' in file
> generalHtml.py on line 11, but no encoding declared; see
> http://www.python.org/peps/pep-0263.html for details"
>
> I code with Kate (2.4, KDE 3.4.0) and everything else works well when
> speaking about this encoding thing. I really hope that someone would
> know a solution. I don't mind if I have to write only ASCII but I'm
> not the only user for that tool, so...
>
Hi Olli,
does it help if you change the second line into:
# -*- coding: iso-8859-15 -*-
?
I *think* that is the correct syntax (at least it works for me).
Michael
More information about the Tutor
mailing list