yufeiminds / echarts-python

Deprecated. Use PyEcharts instead. https://github.com/pyecharts/pyecharts
417 stars 167 forks source link

中文乱码 #10

Open freetest opened 7 years ago

freetest commented 7 years ago

你好。 请问一下中文乱码需要怎么处理了?

luanma

title

freetest commented 7 years ago

补充

yufeiminds commented 7 years ago

抱歉这三个月比较忙碌,才抽出空来维护这个项目。

Python 中大家习惯约定使用 Unicode 来交换中文字符,只需:

chart = Echart(u'中文', u'The data is fake 中文')

即可

freetest commented 7 years ago

我试过在前面加u了,但是直接显示空白。

'title': {'text': u'\u4f60\u597d', 'subtext': 'The data is fakt'}};

freetest commented 7 years ago

''' def echart(request):

chart = Echart(u"你好", "The data is fakt")

chart.use(Bar("Tyloo", ["50", "72", "64", "42", "30", "72"], ))
chart.use(Bar("VG", ["55", "48", "56", "63", "70", "55"]))
chart.use(Axis("category", "bottom", "map", ["de_dust2", "de_cache", "de_mirage", "中文", "de_nuke", "de_cbble"]))
chart.use(Legend(["Tyloo", "VG"], position=('center', "bottom")))
options = chart.json

return render(request,'test/c.html',locals())

'''

yufeiminds commented 7 years ago

有可能是 Axis 的问题,更新下最新的版本试试

weixiaohhh commented 7 years ago

你解决了吗?是版本的问题吗?

weixiaohhh commented 7 years ago

我换成python3 解决的。