In my database the names are stored correctly in UTF-8 encoding (specifically the column shown on the page has the utf8mb4_general_ci coalition in the database). However, when displaying them on the website special characters like ö are replaced by a question mark.
How can I fix this? The website already contains the tag.
If the data is read from the database, please note that by default, database connections on our hosting do NOT use UTF-8 encoding, but latin1 instead. So if you enter special characters through phpMyAdmin (which does use UTF-8 connections) and then display it on your site, it will appear garbled. The same is true if you do the reverse (write from your site and display in phpMyAdmin).
The fix is simple: you need to specify the connection character encoding in your PHP code.