【问题标题】:My Django Admin fields does not show non asccii data correctly我的 Django 管理字段未正确显示非 ascii 数据
【发布时间】:2020-03-21 16:34:59
【问题描述】:

我有一个带有 Mysql 5.7 的 Django 1.11 项目。当我在 Django 管理字段中写入非 ASCII 字符时,例如(چترال کا منظر),它们显示为????????????

看来我的数据库并没有按照我的意愿存储数据;这是我的数据库字符集。

我在这里缺少什么?

【问题讨论】:

  • 有趣。你在用python 2吗?
  • 是的,我在 python 2.7

标签: mysql django mysql-python


【解决方案1】:

我能够通过在我的表上运行以下命令来解决此问题。

alter table `tagging_taggeditem` convert to character set utf8 collate utf8_unicode_ci;

之后我不得不重新保存 django 模型以正确填充值。

【讨论】:

    猜你喜欢
    • 2017-05-08
    • 1970-01-01
    • 2014-12-01
    • 2019-05-21
    • 1970-01-01
    • 2018-11-20
    • 2020-07-09
    • 2016-11-19
    • 1970-01-01
    相关资源
    最近更新 更多