django loading fixtures在unicode数据上失败

时间:2012-10-16 10:03:50

标签: mysql django unicode django-fixtures

我通过dumpdata保存了一堆灯具,这是一个例子:

[
  {
    "pk": 1,
    "model": "core.question",
    "fields": {
      "text": "\u041a\u0430\u043a\u0438\u0445 \u0436\u0438\u0432\u043e\u0442\u043d\u044b\u0445 \u0432\u044b \u0434\u0435\u0440\u0436\u0438\u0442\u0435 \u0434\u043e\u043c\u0430",
      "is_free_text": false
    }
  },
  {
    "pk": 2,
    "model": "core.question",
    "fields": {
      "text": "\u0415\u0434\u0438\u0442\u0435 \u043b\u0438 \u0432\u044b \u043c\u044f\u0441\u043e?",
      "is_free_text": false
    }
  },
  {
    "pk": 3,
    "model": "core.question",
    "fields": {
      "text": "\u041a\u0430\u043a\u043e\u0439 \u0435\u043d\u043e\u0442 \u0436\u0438\u0432\u0435\u0442 \u0443 \u0432\u0430\u0441 \u0434\u043e\u043c\u0430",
      "is_free_text": false
    }
  }
]

当我做的时候

  

manage.py loaddata core_question.json

,出现以下错误:

  

警告:字符串值不正确:'\ xD0 \ x94 \ xD0 \ xB8 \ xD0 \ xB0 ...'   第1行第'first_name'列

我虽然它可能是数据库的东西,但它似乎都是unicode:

character_set_client,utf8
character_set_connection,utf8
character_set_database,utf8
character_set_filesystem,binary
character_set_results,utf8
character_set_server,utf8
character_set_system,utf8
character_sets_dir,/usr/share/mysql/charsets/

以及架构排序规则:

  

CATALOG_NAME,SCHEMA_NAME,DEFAULT_CHARACTER_SET_NAME,DEFAULT_COLLATION_NAME,SQL_PATH   NULL,评,UTF8,utf8_general_ci,NULL

我还缺少其他东西吗?

0 个答案:

没有答案