Another å, ä, ö question

Peter Otten __peter__ at web.de
Tue Sep 20 16:34:32 EDT 2016


Martin Schöön wrote:

> Den 2016-09-19 skrev Christian Gollwitzer <auriocus at gmx.de>:
>> Am 19.09.16 um 22:21 schrieb Martin Schöön:
>>> I am studying some of these tutorials:
>>> https://pythonprogramming.net/matplotlib-intro-tutorial/
>>>
>>> I am recreating the code and I use my native Swedish for comments,
>>> labels and titles. Until now I have been doing so using Geany
>>> and executing using F5. This works fine.
>>>
>>> But -- now I tested using emacs instead using C-c C-c to execute.
>>> Noting happens so I try to run the program from command line and
>>> find that now Python can't stand my å, ä and ö.
>>>
>>> I am puzzled: With Geany there is no problem but outside Geany
>>> I am punished by Python for using Swedish.
>>
>> you are not "punished for Swedish", you need to tell Python the encoding
>> of the file it runs. See here:
>> https://www.python.org/dev/peps/pep-0263/
>>
>> Assuming that you use UTF-8 (you should check with an emacs expert, I am
>> not an emacs user), try putting the header
>>
>> #!/usr/bin/python
>> # -*- coding: utf-8 -*-
>>
>> on top of your files.
>>
> I already have this and since it doesn't work from command line
> either it can't be an emacs unique problem.
> 
> Still confused...
> 
> Too late to find a emacs forum tonight.
> 
> /Martin

Are all non-ascii strings unicode? I. e.

u"Schöön" rather than just "Schöön"

?




More information about the Python-list mailing list