Opened 7 years ago

Closed 7 years ago

#11443 closed (worksforme)

smart_str can't encode a unicde string

Reported by: spam@… Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I'm getting

encode() takes at most 2 arguments (3 given)

From line 95 of django/utils/encoding.py :

elif isinstance(s, unicode):

return s.encode(encoding, errors)

I think it should be

elif isinstance(s, unicode):

return s.encode(encoding)

I'm on python 2.5

Change History (1)

comment:1 Changed 7 years ago by dc

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: worksforme
Status: newclosed

Cannot reproduce this bug:

>>> from django.utils.encoding import smart_str
>>> smart_str(u'iñtërnâtiônàlizætiøn')
'i\xc3\x83\xc2\xb1t\xc3\x83\xc2\xabrn\xc3\x83\xc2\xa2ti\xc3\x83\xc2\xb4n\xc3\x83\xc2\xa0liz\xc3\x83\xc2\xa6ti\xc3\x83\xc2\xb8n'
Note: See TracTickets for help on using tickets.
Back to Top