Closed Bug 602134 Opened 14 years ago Closed 14 years ago

UnicodeEncodeError: 'ascii' codec can't encode character

Categories

(support.mozilla.org :: Army of Awesome, task)

task
Not set
major

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: stephend, Assigned: jsocol)

References

()

Details

Attachments

(1 file)

We're seeing the following Unicode traceback when trying to Tweet with stuff like アドオンをブラウズ:

Traceback (most recent call last):

  File "/data/www/support.mozilla.com/kitsune/vendor/src/django/django/core/handlers/base.py", line 100, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/data/www/support.mozilla.com/kitsune/apps/twitter/__init__.py", line 50, in wrapper
    return view_func(request, *args, **kwargs)

  File "/data/www/support.mozilla.com/kitsune/apps/customercare/views.py", line 73, in twitter_post
    if not is_printable(content):

  File "/data/www/support.mozilla.com/kitsune/apps/customercare/views.py", line 61, in is_printable
    try: s.decode(codec)

  File "/data/virtualenvs/BASELINE/lib64/python2.6/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2603' in position 15: ordinal not in range(128)
Assignee: nobody → james
http://github.com/jsocol/kitsune/commit/fb1699f9309df

Also added slightly more robust handle of user input, here:
http://github.com/jsocol/kitsune/commit/7af44824
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Verified FIXED on https://support-stage.mozilla.com/en-US/army-of-awesome.

In addition to the mini-testcase in comment 0, I regression-tested empty and too-long posts, and they both triggered their respective error messages.
Status: RESOLVED → VERIFIED
Target Milestone: --- → 2.2.6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: