升级到 2.1.0 Final 后出现 Unicode 错误
我最近将 DjangoCMS 项目从 2.1.0beta3 升级到 2.1.0 最后,我在页面编辑过程中开始遇到 Unicode 错误。 大量生产内容被迁移 与南前进。我在(使用 TinyMCE)尝试时收到错误 将另一个插件(例如图像)插入文本插件或当我 尝试将插件添加到占位符。
网址:
/admin/cms/page/188/edit-plugin/673/edit-plugin/676/
堆栈跟踪:
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.BoundField'>)
如果我反复尝试创建插件,则 ID(此处为 676)会递增, 所以看起来错误是在渲染表单时发生的。这 影响链接、图片和预告片插件,但不影响文本、文件或 片段插件。
如果您能帮助我找出原因,我将不胜感激。
谢谢,
迈克尔
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.BoundField'>)
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
答案有点晚了,但我在 unicode 方面遇到了一些问题,并通过 定义源代码解决了编码 另请参阅 http://evanjones.ca/python-utf8.html
我把它放在
有问题的文件的顶部,一切都被排序了。
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
at the top of the offending files and everything was sorted.
事实证明,这是一个数据迁移问题。最终的解决方案是使用以下命令在相关 mysql 表中强制使用 utf8 编码:
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: