Another å, ä, ö question

Martin Schöön martin.schoon at gmail.com
Tue Sep 20 16:17:10 EDT 2016


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



More information about the Python-list mailing list