I am quite new to SQL, Flask, and overall web-developement but I wanted to learn about it so I started a little project.
The Problem appears when I try to display content from my SQL-Tables on the website. It does not display the letter ü, instead it shows ü.
Texts on the website and Strings which where assigned in python are not affected by this problem.
Setup:
- MySQL Docker Container with database which contains preloaded Contents, loaded from an SQL-File:
use db;CREATE TABLE example( ExampleID int not null AUTO_INCREMENT, ExampleText varchar(100) NOT NULL, PRIMARY KEY (ExampleID));INSERT INTO example(ExampleText)VALUES("ü");
- Python Container using Flask Framework to display data from MySQL-Tables on the Website like this:
@views.route("/")def index(): cursor = connection.cursor() cursor.execute('SELECT ExampleText FROM questions') value = cursor.fetchone() return render_template("index.html", displayed_text=value[0])
- Ngnx Container, but this should not be the problem.
At first I tried to solve the problem with the following command in my docker-compose.yaml File: command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
After this I tried to change the Charset inside the SQL File from above:
ALTER DATABASE db CHARACTER SET utf8 COLLATE utf8_general_ci;use db;CREATE TABLE example( ExampleID int not null AUTO_INCREMENT, ExampleText varchar(100) NOT NULL, PRIMARY KEY (ExampleID));ALTER TABLE example CHARACTER SET utf8 COLLATE utf8_general_ci;INSERT INTO example(ExampleText)VALUES("ü");
Both did not work.
After every change I tried, I deleted the existing containers, Images and Volumes and also cleared the build cache so there shouldn't be a problem coming from docker using the wrong cached version of anything.