开发者

Unicode errors after upgrade to 2.1.0 final

开发者 https://www.devze.com 2023-02-09 15:23 出处:网络
I\'ve recently upgraded a DjangoCMS project from 2.1.0beta3 to 2.1.0 final, and I\'ve started getting Unicode errors during page editing.

I've recently upgraded a DjangoCMS project from 2.1.0beta3 to 2.1.0 final, and I've started getting Unicode errors during page editing. There was a large volume of production content that was migrated forward with South. I get the error while (using TinyMCE) I try to insert another plugin, such as an image, into a text plugin or when I try to add a plugin to a placeholder.

URL:

/admin/cms/page/188/edit-plugin/673/edit-plugin/676/

Stack Trace:

  File "/srv/wsphp/wspython/virtualenv/iaffe-prod/lib/python2.6/site-packages/django/template/__init__.py", line 849, in render
   return _render_value_in_context(output, context)

 File "/srv/wsphp/wspython/virtualenv/iaffe-prod/lib/python2.6/site-packages/django/template/__init__.py", line 829, in _render_value_in_context
   value = force_unicode(value)

 File "/srv/wsphp/wspython/virtualenv/iaffe-prod/lib/python2.6/site-packages/django/utils/encoding.py", line 88, in force_unicode
   raise DjangoUnicodeDecodeError(s, *e.args)

DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 12: ordinal not in range(128). You passed in <django.forms.forms.BoundField object at 0xb73cedec> (<class 'django.forms.forms.BoundFi开发者_开发问答eld'>)

If I repeatedly try to create the plugin, the ID (676 here) increments, so it looks like the error happens when the form is rendered. This affects link, picture, and teaser plugins, but not text, file or snippet plugins.

I'd appreciate any help in isolating the cause here.

Thanks,

Michael


Bit of a late answer, but I had some problems with unicode and solved in with defining source code encodings also see http://evanjones.ca/python-utf8.html

I put

# -*- coding: utf-8 -*-

at the top of the offending files and everything was sorted.


It turns out that this was a data migration issue. The ultimate solution was to force utf8 encoding in the relevant mysql tables using commands like:

alter table cms_page convert to character set utf8;
0

精彩评论

暂无评论...
验证码 换一张
取 消