Re: Another å, ä, ö question
Christian Gollwitzer
auriocus at gmx.de
Mon Sep 19 16:28:49 EDT 2016
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.
Christian
More information about the Python-list
mailing list