[Tutor] Unicode encoding and raw_input() in Python 2.7 ?

Samuel VISCAPI samuel.viscapi at univ-montp2.fr
Fri Apr 17 10:39:01 CEST 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

This is my first post to that mailing list if I remember correctly, so
hello everyone !

I've been stuck on a simple problem for the past few hours. I'd just
like raw_input to work with accentuated characters.

For example:

firstname = str.capitalize(raw_input('First name: '))

where firstname could be "Valérie", "Gisèle", "Honoré", etc...

I tried -*- coding: utf-8 -*-, u'', unicode(), but to no avail...

I'm using str.capitalize and str.lower throughout my code, so I guess
some encoding / decoding will also be necessary at some point.

Thanks a lot for your help !

Cheers, Samuel



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)

iF4EAREIAAYFAlUwxqUACgkQqjnQbvs+kDn4AAD/YHz55tvBixTgdp16L45tc8Dr
/0jyPNg9aMndpwoDlLkA/2SnSWLkeSwI4xM9xKbucx+28I50NcEG/8wx8c31GWll
=KI8s
-----END PGP SIGNATURE-----


More information about the Tutor mailing list