简体   繁体   English

如何解决 flask 生产中的 Unicode 问题,例如 Ieeo?

[英]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.

相关问题 Python、flask、babel-消息和例如西班牙语 - 如何 - Python, flask, babel- message, and e.g. Spanish - How to 如何在Windows cmd上将不支持的unicode字符打印为“?”而不是引发异常? - How to print unsupported unicode characters on Windows cmd as e.g. “?” instead of raising exception? 如何检查从flask传入到html文件的变量是否是某种类型(例如字符串、整数) - How to check whether a variable passed in from flask to an html file is a certain type (e.g. string, integer) 将带有unicode字符的字符串(例如→,∧,¬)转换为乳胶所示的字符串? - Convert string with unicode characters e.g. →,∧,¬ into strings illustrated in latex? 如何使用 Flask 在 1 个响应中将 send_file() 与另一个信息(例如,int)结合起来 - How can combine send_file() with another information (E.g., int) in 1 response using Flask 如何在Flask MethodView中使用装饰器(例如oauth.require_oauth) - How to use decorators with Flask MethodView (e.g., oauth.require_oauth) Flask-Restless的复杂路由(例如“忘记密码”) - Complex routes for Flask-Restless (e.g. “forgot password”) 名称生成器问题:如何修改代码以为我指定的每个条件提供多个(例如20个)名称选项 - Name Generator Problem: How can I modify the code to provide multiple (e.g. 20) name options for each criteria I specify 打印 unicode 字符名称 - 例如 'GREEK SMALL LETTER ALPHA' - 而不是 'α' - Printing unicode character NAMES - e.g. 'GREEK SMALL LETTER ALPHA' - instead of 'α' Scrapy输出提供国际unicode字符(例如日语字符) - Scrapy output feed international unicode characters (e.g. Japanese chars)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM