Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76319
| References | <4dd67a80-b466-4866-ab67-d9a94c0b7ddf@googlegroups.com> <53ecba3e$0$1989$426a74cc@news.free.fr> <d460fa66-e881-4b80-9f86-cf82b3aa45ca@googlegroups.com> <53eccc08$0$2932$426a34cc@news.free.fr> <53ecd406$0$29971$c3e8da3$5496439d@news.astraweb.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2014-08-14 10:12 -0600 |
| Subject | Re: Unable to run print('Réussi') on windows and on linux |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13003.1408032785.18130.python-list@python.org> (permalink) |
On Thu, Aug 14, 2014 at 9:21 AM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > YBM wrote: > >> Le 14/08/2014 16:04, marc.vanhoomissen@gmail.com a écrit : >>> Hello YBM, >>> I tried your suggestions, without improvement. >>> Further, see my answer to Vincent Vande Vyre >>> Thanks anyway. >> >> This is indeed very surprising. Are you sure that you >> have *exactly* this line at the first or second (not >> later !) line of your script : >> >> # -*- encoding: utf-8 -*- >> >> if a single caracter differs, it would fail. > > That's not correct. The encoding declaration is very flexible. Any of these > will be accepted: > > # This file uses the encoding: utf_8 > # coding=UTF-8 > # -*- coding: utf8 -*- > # vim: set fileencoding=utf-8 : > # Uses encoding:utf8 > # I want my encoding=UtF_8 okay! > #### textencoding= UTf-8 blah blah blah > > and many, many other varieties. The rules are: > > (1) It must be a comment; > > (2) It must be in the first or second line of the file; > > (3) It must match the regular expression r"coding[:=]\s*([-\w.]+)" > > > However, just because you declare the file to be UTF-8, doesn't mean it > *actually is* UTF-8. If your text editor is configured to use (say) > Latin-1, a UTF-8 encoding declaration will just give you garbage. > > * Fix your system to use UTF-8 by default. > > * Fix your editor to use UTF-8. > > * Add a UTF-8 encoding declaration. > > And then things should work. And apart from all of that, if the OP is really using Python 3 then UTF-8 is the default source encoding anyway.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Unable to run print('Réussi') on windows and on linux marc.vanhoomissen@gmail.com - 2014-08-14 05:35 -0700
Re: Unable to run print('Réussi') on windows and on linux YBM <ybmess@nooos.fr.invalid> - 2014-08-14 15:31 +0200
Re: Unable to run print('Réussi') on windows and on linux marc.vanhoomissen@gmail.com - 2014-08-14 07:04 -0700
Re: Unable to run print('Réussi') on windows and on linux Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-14 15:38 +0100
Re: Unable to run print('Réussi') on windows and on linux YBM <ybmess@nooos.fr.invalid> - 2014-08-14 16:47 +0200
Re: Unable to run print('Réussi') on windows and on linux Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-15 01:21 +1000
Re: Unable to run print('Réussi') on windows and on linux Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-14 10:12 -0600
Re: Unable to run print('Réussi') on windows and on linux wxjmfauth@gmail.com - 2014-08-15 01:25 -0700
Re: Unable to run print('Réussi') on windows and on linux Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2014-08-14 16:46 +0200
Re: Unable to run print('Réussi') on windows and on linux Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2014-08-14 15:22 +0200
Re: Unable to run print('Réussi') on windows and on linux marc.vanhoomissen@gmail.com - 2014-08-14 07:01 -0700
Re: Unable to run print('Réussi') on windows and on linux Peter Otten <__peter__@web.de> - 2014-08-14 18:00 +0200
Re: Unable to run print('Réussi') on windows and on linux Anssi Saari <as@sci.fi> - 2014-08-14 17:36 +0300
Re: Unable to run print('Réussi') on windows and on linux wxjmfauth@gmail.com - 2014-08-15 01:23 -0700
csiph-web