Answer the question
In order to leave comments, you need to log in
How to achieve Cyrillic support in Python3 flask + mysql?
Hello. When designing the simplest web api in Python3, I ran into a problem:
Answer the question
In order to leave comments, you need to log in
The solution was kindly provided in the comments by user pcdesign .
To read the required encoding from the database, the following version of the pymysql.connect() method was used:
db = pymysql.connect(host='localhost',
user='myuser',
passwd='welcome',
db='mydb',
charset='utf8')
app = Flask(__name__)
app.config['JSON_AS_ASCII'] = False
You should definitely start by reading the Unicode HOWTO of the Python documentation. And be sure to make sure that the base encoding is UTF-8.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question