[ 
https://issues.apache.org/jira/browse/AVRO-565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13253964#comment-13253964
 ] 

Miki Tebeka commented on AVRO-565:
----------------------------------

Russel, the problem is that you pass a *str* with unicode characters. Python 
has no way of knowing the encoding and the default if 'ascii'. If you prepend a 
'u' to make the body unicode:
{code}
email_hash = {'body': u"Verit\xc3\xa1\r\nEstat\xc3\xadstica\r\n"}
{code}
This will work since now it's a unicode string and it can be encoded.

As a side note - these kind of things were one of the reasons for Python 3. I 
also recommend viewing [this 
video|http://pyvideo.org/video/948/pragmatic-unicode-or-how-do-i-stop-the-pain] 
which personally helped me.

I'll give you time to respond before closing this.
                
> Investigate Python encoding error
> ---------------------------------
>
>                 Key: AVRO-565
>                 URL: https://issues.apache.org/jira/browse/AVRO-565
>             Project: Avro
>          Issue Type: Bug
>          Components: python
>            Reporter: Jeff Hammerbacher
>         Attachments: reproduce_avro_565.py
>
>
> Tyler B is seeing the following encoding error: 
> http://avro.pastebin.com/b4HSYjCz.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to