UnicodeEncodeError at /questions/ask/
Hello, I am using most recent version of askbot from github (askbot-devel). When I am trying to create a new question with unicode letters in title I get following error:
UnicodeEncodeError at /questions/ask/
'ascii' codec can't encode characters in position 3-5: ordinal not in range(128)
Environment:
Request Method: POST
Request URL: http://.../questions/ask/
Django Version: 1.5.2
Python Version: 2.7.3
Installed Applications:
('longerusername',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.humanize',
'django.contrib.sitemaps',
'django.contrib.messages',
'compressor',
'askbot',
'askbot.deps.django_authopenid',
'south',
'askbot.deps.livesettings',
'keyedcache',
'robots',
'django_countries',
'djcelery',
'djkombu',
'followit',
'tinymce',
'group_messaging')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
'askbot.middleware.forum_mode.ForumModeMiddleware',
'askbot.middleware.cancel.CancelActionMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'askbot.middleware.view_log.ViewLogMiddleware',
'askbot.middleware.spaceless.SpacelessMiddleware')
Traceback:
File "/home/dev/askbot/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
115. response = callback(request, *callback_args, **callback_kwargs)
File "/home/dev/askbot/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
91. response = view_func(request, *args, **kwargs)
File "/home/dev/askbot/env/src/askbot/askbot/utils/decorators.py" in wrapper
136. return view_func(request, *args, **kwargs)
File "/home/dev/askbot/env/src/askbot/askbot/utils/decorators.py" in wrapper
231. return view_func(request, *args, **kwargs)
File "/home/dev/askbot/env/src/askbot/askbot/views/writers.py" in ask
259. language=language
File "/home/dev/askbot/env/src/askbot/askbot/models/__init__.py" in user_post_question
1759. language=language
File "/home/dev/askbot/env/src/askbot/askbot/models/question.py" in create_new
172. parse_results = question.parse_and_save(author=author, is_private=is_private)
File "/home/dev/askbot/env/src/askbot/askbot/models/post.py" in parse_and_save
507. data = self.parse_post_text()
File "/home/dev/askbot/env/src/askbot/askbot/models/post.py" in parse_post_text
439. text = text_converter(self.text)
File "/home/dev/askbot/env/src/askbot/askbot/utils/markup.py" in markdown_input_converter
205. text = urlize_html(text)
File "/home/dev/askbot/env/src/askbot/askbot/utils/html.py" in urlize_html
70. soup = BeautifulSoup(html, 'html5lib')
File "/home/dev/askbot/env/local/lib/python2.7/site-packages/bs4/__init__.py" in __init__
167. if os.path.exists(markup):
File "/home/dev/askbot/env/lib/python2.7/genericpath.py" in exists
18. os.stat(path)
Exception Type: UnicodeEncodeError at /questions/ask/
Exception Value: 'ascii' codec can't encode characters in position 3-5: ordinal not in range(128)
Comments
give this a try http://askbot.org/en/question/11429/how-to-enable-unicode-in-url-slug/</p<>>
Is this in the production setup?
Evgeny, actually I've tried first to install stable version 0.7.43. But python manage.py migrate askbot failed on both mysql and postgres. Then I tried git latest version and migrate passed succesfully but I got unicode error.
Evgeny, I have the same problem with cyrillic. i.e.: I add simple test question (see screenhot: http://my.jetscreenshot.com/5516/20131007-uerk-28kb.jpg) and get the following result with "UnicodeEncodeError at /questions/ask/" error: http://my.jetscreenshot.com/5516/20131007-r9l1-159kb.jpg I am using the completely new version of Askbot (0.7.49), django 1.5.4 Error appears when I add russian text from keybord to descripton of the question filed or to the answer. Error never apper when I copy-paste russian text from UTF-8 website like http://wikipedia.org That is all quite strange I would be very thankful, if you coul tell what is the reason of it or any idea about this one. (parameter ALLOW_UNICODE_SLUGS is set to True) UPDATED: the reason was - that I used it as gunicorn, when I launched it as runserver - it started to work without any errors