Django mysql阿拉伯语编码 [英] Django mysql arabic encoding

查看:110
本文介绍了Django mysql阿拉伯语编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有mysql数据库的django应用程序.我们正在尝试启动该网站的阿拉伯文版本.当前语言是英语.由于某些原因,当我通过管理面板用阿拉伯语编写内容并单击保存"时,它会显示????而不是我写的阿拉伯字.我不知道如何解决它.

I've a django app with a mysql database. We are trying to launch the Arabic version of the website. The current language is English. For some reason when I write something in Arabic through the admin panel and click save, it shows ???? instead of the Arabic word i wrote. I've no idea how to fix it.

我关注了此帖子,并将#-*- coding: utf-8 -*-添加到了我的admin.py,models.py和views.py文件.没用

I followed this post and added #-*- coding: utf-8 -*- to my admin.py, models.py and views.py files. It didn't work

我还将这些添加到my.conf mysql文件中以更改字符集.它也不起作用.

I also added these to my.conf mysql file to change the character set. It didn't work either.

character-set-server=utf8
collation-server=utf8_unicode_ci
init_connect='set collation_connection = utf8_unicode_ci;'

推荐答案

可能发生的事情:

  • 您有utf8编码的数据(很好)
  • SET NAMES latin1有效(默认,但不正确)
  • 该列被声明为CHARACTER SET latin1(默认,但错误)
  • you had utf8-encoded data (good)
  • SET NAMES latin1 was in effect (default, but wrong)
  • the column was declared CHARACTER SET latin1 (default, but wrong)

请提供SHOW CREATE TABLE,以便我们制定一个ALTER来修复列.

Please provide SHOW CREATE TABLE so we can formulate an ALTER to fix the columns.

Django需要client_encoding: 'UTF8';抱歉,我不知道要去哪里.

Django needs client_encoding: 'UTF8'; sorry, I don't know where that goes.

这篇关于Django mysql阿拉伯语编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆