[GH-ISSUE #582] Webmail -> Compose Internal Error: UnicodeEncodeError: 'ascii' codec can't encode character u'\u0421' in position 15 #547

Closed
opened 2026-02-27 11:12:20 +03:00 by kerem · 0 comments
Owner

Originally created by @mrh666 on GitHub (Jul 16, 2014).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/582

Originally assigned to: @tonioo on GitHub.

Hi there,
I found a bug. User use Russian letters in his signature get an error message when compose a new message. Change them to English letters and error is gone.

[Django] ERROR (EXTERNAL IP): Internal Server Error: /webmail/
Traceback (most recent call last):

File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 113, in get_response
response = callback(request, _callback_args, *_callback_kwargs)

File "/usr/lib/python2.6/site-packages/django/contrib/auth/decorators.py", line 25, in _wrapped_view
return view_func(request, _args, *_kwargs)

File "/usr/lib/python2.6/site-packages/modoboa/extensions/admin/lib.py", line 27, in wrapped_f
return f(request, _args, *_kwargs)

File "/usr/lib/python2.6/site-packages/modoboa/extensions/webmail/views.py", line 533, in index
response = globals()action

File "/usr/lib/python2.6/site-packages/modoboa/extensions/webmail/views.py", line 392, in compose
return render_compose(request, form, url, insert_signature=True)

File "/usr/lib/python2.6/site-packages/modoboa/extensions/webmail/views.py", line 354, in render_compose
body += str(signature)

UnicodeEncodeError: 'ascii' codec can't encode character u'\u0421' in position 15: ordinal not in range(128)

<WSGIRequest
path:/webmail/,
GET:<QueryDict: {u'action': [u'compose'], u'_': [u'1405462575322']}>,
POST:<QueryDict: {}>,
COOKIES:{'ga': 'GA1.2.961441936.1398947327',
'csrftoken': 'TGCCP795ibROqPnaxAeOAZvVnmdqGJz1',
'sessionid': 'zf00ab9pdiiktmu59rmcnwy8u64oyj0c'},
META:{'CONTENT_LENGTH': '',
'CONTENT_TYPE': '',
u'CSRF_COOKIE': u'TGCCP795ibROqPnaxAeOAZvVnmdqGJz1',
'DOCUMENT_ROOT': '/home/user/modoboa/modoboa',
'HTTP_ACCEPT': 'application/json, text/javascript, /; q=0.01',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
'HTTP_ACCEPT_LANGUAGE': 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4',
'HTTP_CONNECTION': 'keep-alive',
'HTTP_COOKIE': 'ga=GA1.2.961441936.1398947327; csrftoken=TGCCP795ibROqPnaxAeOAZvVnmdqGJz1; sessionid=zf00ab9pdiiktmu59rmcnwy8u64oyj0c',
'HTTP_DNT': '1',
'HTTP_HOST': 'myhost',
'HTTP_REFERER': 'http://myhost/webmail/',
'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36',
'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
'PATH_INFO': u'/webmail/',
'QUERY_STRING': 'action=compose&
=1405462575322',
'REMOTE_ADDR': 'xx.xx.xx.xx',
'REMOTE_PORT': '51234',
'REQUEST_METHOD': 'GET',
'REQUEST_URI': '/webmail/?action=compose&
=1405462575322',
u'SCRIPT_NAME': u'',
'SERVER_NAME': 'myhostname',
'SERVER_PORT': 'myport',
'SERVER_PROTOCOL': 'HTTP/1.1',
'UWSGI_APPID': 'myhostname:myport|',
'UWSGI_SCRIPT': 'modoboa.wsgi:application',
'uwsgi.node': 'myhostname',
'uwsgi.version': '2.0.4',
'wsgi.errors': <open file 'wsgi_errors', mode 'w' at 0x220d5d0>,
'wsgi.file_wrapper': ,
'wsgi.input': <uwsgi._Input object at 0x5126d20>,
'wsgi.multiprocess': True,
'wsgi.multithread': False,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)}>

Originally created by @mrh666 on GitHub (Jul 16, 2014). Original GitHub issue: https://github.com/modoboa/modoboa/issues/582 Originally assigned to: @tonioo on GitHub. Hi there, I found a bug. User use Russian letters in his signature get an error message when compose a new message. Change them to English letters and error is gone. [Django] ERROR (EXTERNAL IP): Internal Server Error: /webmail/ Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 113, in get_response response = callback(request, _callback_args, *_callback_kwargs) File "/usr/lib/python2.6/site-packages/django/contrib/auth/decorators.py", line 25, in _wrapped_view return view_func(request, _args, *_kwargs) File "/usr/lib/python2.6/site-packages/modoboa/extensions/admin/lib.py", line 27, in wrapped_f return f(request, _args, *_kwargs) File "/usr/lib/python2.6/site-packages/modoboa/extensions/webmail/views.py", line 533, in index response = globals()[action](request) File "/usr/lib/python2.6/site-packages/modoboa/extensions/webmail/views.py", line 392, in compose return render_compose(request, form, url, insert_signature=True) File "/usr/lib/python2.6/site-packages/modoboa/extensions/webmail/views.py", line 354, in render_compose body += str(signature) UnicodeEncodeError: 'ascii' codec can't encode character u'\u0421' in position 15: ordinal not in range(128) <WSGIRequest path:/webmail/, GET:<QueryDict: {u'action': [u'compose'], u'_': [u'1405462575322']}>, POST:<QueryDict: {}>, COOKIES:{'_ga': 'GA1.2.961441936.1398947327', 'csrftoken': 'TGCCP795ibROqPnaxAeOAZvVnmdqGJz1', 'sessionid': 'zf00ab9pdiiktmu59rmcnwy8u64oyj0c'}, META:{'CONTENT_LENGTH': '', 'CONTENT_TYPE': '', u'CSRF_COOKIE': u'TGCCP795ibROqPnaxAeOAZvVnmdqGJz1', 'DOCUMENT_ROOT': '/home/user/modoboa/modoboa', 'HTTP_ACCEPT': 'application/json, text/javascript, _/_; q=0.01', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch', 'HTTP_ACCEPT_LANGUAGE': 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE': '_ga=GA1.2.961441936.1398947327; csrftoken=TGCCP795ibROqPnaxAeOAZvVnmdqGJz1; sessionid=zf00ab9pdiiktmu59rmcnwy8u64oyj0c', 'HTTP_DNT': '1', 'HTTP_HOST': 'myhost', 'HTTP_REFERER': 'http://myhost/webmail/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36', 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest', 'PATH_INFO': u'/webmail/', 'QUERY_STRING': 'action=compose&_=1405462575322', 'REMOTE_ADDR': 'xx.xx.xx.xx', 'REMOTE_PORT': '51234', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/webmail/?action=compose&_=1405462575322', u'SCRIPT_NAME': u'', 'SERVER_NAME': 'myhostname', 'SERVER_PORT': 'myport', 'SERVER_PROTOCOL': 'HTTP/1.1', 'UWSGI_APPID': 'myhostname:myport|', 'UWSGI_SCRIPT': 'modoboa.wsgi:application', 'uwsgi.node': 'myhostname', 'uwsgi.version': '2.0.4', 'wsgi.errors': <open file 'wsgi_errors', mode 'w' at 0x220d5d0>, 'wsgi.file_wrapper': <built-in function uwsgi_sendfile>, 'wsgi.input': <uwsgi._Input object at 0x5126d20>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}>
kerem 2026-02-27 11:12:20 +03:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#547
No description provided.