[Py-MAD] Una duda de encodings

Carlos Hernando Carasol carlos.hernando at gmail.com
Tue Jun 3 10:42:27 CEST 2014


Hola Pablo,

Creo que es política de la lista que hagas este tipo de consultas en
https://mail.python.org/mailman/listinfo/python-es
pero bueno...

2014-06-03 9:11 GMT+02:00 Pablo <legendario82 at gmail.com>:

> except AssertionError as e: self.verificationErrors.append(str(e))
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xfa' in
> position 124: ordinal not in range(128)
>

>>> s = u" última hora."
>>> s
u' \xfaltima hora.'
>>> str(s)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfa' in
position 1: ordinal not in range(128)
>>> unicode(s)
u' \xfaltima hora.'

A str no le gustan los unicode (pásate a Python 3 ;) ). Revisa Python
Unicode Howto.

Saludos,


Carlos.
-- 
@chernando
http://www.linkedin.com/in/chernando
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.es.python.org/pipermail/madrid/attachments/20140603/a9fc15ce/attachment.html>


More information about the Madrid mailing list