Skip to content

body=urllib.urlencode(data)) error in Python 2.6 #1

Description

@jdiederichs

I got this error for a message that contained an apostrophy in the body (description):
File "/usr/lib64/python2.6/urllib.py", line 1261, in urlencode
v = quote_plus(str(v))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 42: ordinal not in range(128)

A workaround is to first convert the description to Unicode:
data = {
'apikey': self.apikey,
'application': application,
'event': event,
'description': description.encode('utf-8'),
'priority': priority
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions