I have the Flask application which shows the address of a person. I have stored text in Hindi in MySQL in address column. When I am fetching data using query it is displaying proper text. Refer below
mysql> select address from addresses where id=1;
Output: शहर (proper Hindi text)
But when I am fetching(from MySQL) the same data using Flask app, My browser is showing this type of text
यà¤à¥à¤à¤¤à¤¾à¤ªà¥à¤°à¤®
I am not able to get the exact data that is stored in the database. If it is a problem in MySQL then why I am getting proper text when running query.
I have set(below) in Flask
app.config['MYSQL_CHARSET'] = 'utf8mb4'
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
is also set in all HTML files.
I have tried all the solutions from stack overflow but no success. Given below are the properties of MySQL table(for ref)
mysql> show create table addresses;
CREATE TABLE `addresses` (
`id` varchar(128) NOT NULL,
`address` varchar(512) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
mysql> SHOW VARIABLES LIKE 'collation%';
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| collation_connection | utf8mb4_unicode_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8mb4_unicode_ci |
+----------------------+--------------------+
Its been a week I am trying to solve this but no result. Please help!