Sorry for the poor formatting (couldn't find how to edit the previous
post):

  >>> s = 'La Pe\xf1a'
  >>> print s
  La Pe±a
  >>> s.encode('utf8')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position
5: ordinal not in range(128)
  >>> s.encode('utf8','ignore')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position
5: ordinal not in range(128)
  >>> s.encode('utf8','replace')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position
5: ordinal not in range(128)
  >>> u = unicode(s, 'utf8')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "C:\Python25\lib\encodings\utf_8.py", line 16, in decode
      return codecs.utf_8_decode(input, errors, True)
  UnicodeDecodeError: 'utf8' codec can't decode bytes in position 5-6:
unexpected end of data
  >>> u = unicode(s, 'utf8', 'ignore')
  >>> u
  u'La Pe'
  >>> u = unicode(s, 'utf8', 'replace')
  >>> u
  u'La Pe\ufffd'
  >>>

Pv

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en

Reply via email to