[英]How to solve Unicode problem in flask production e.g. Ieeo?
I am building flask application with some data in Cyrillic text format.我正在使用西里尔文本格式的一些数据构建 flask 应用程序。 When I serve flask development server in my machine, there is no issue whatsoever sending text in Cyrillic format to the front.
当我在我的机器上服务 flask 开发服务器时,将西里尔格式的文本发送到前面没有任何问题。 However, after deploying it in actual in-house server, ofc that is different machine than that of mine, of my company, all Cyrillic text turn into sth similar to this 'Oeaaiaaaoa?'.
但是,在将其部署到与我公司不同的机器的实际内部服务器中后,所有西里尔文文本都变成了类似于“Oeaaiaaaoa?”的东西。 I have never seen this kind of format during my development on my machine and dont know what to do about it.
在我的机器上开发过程中,我从未见过这种格式,也不知道该怎么办。
I have no code or code snippet or file that has anything to do with encoding or unicode in my project because I have no idea where to put those settings.我的项目中没有与编码或 unicode 有任何关系的代码或代码片段或文件,因为我不知道将这些设置放在哪里。 Only thing I can provide that may be useful regarding code is I am using jsonify from flask with no additional argument specified for response in every api.
我唯一能提供的对代码有用的是我正在使用来自 flask 的 jsonify,并且没有为每个 api 中的响应指定额外的参数。 Can someone help?
有人可以帮忙吗?
You could try using string.encode('utf-8').decode('utf-8')
before passing it to jsonify function您可以尝试使用
string.encode('utf-8').decode('utf-8')
在将其传递给 jsonify function
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.