I can't get a simple update or insert to save special äöü characters. Instead they are being stored as äöü.
The website displays äöü characters correctly if they are already stored as äöü in the database using phpMyAdmin (or some other tool like HeidiSQL), but for some reason I can't use my code/connection to the database to store them properly. This is where I stand:
I added charset=utf8
to my connection string:
MM_Connection_STRING = "PROVIDER=MSDASQL;DRIVER={MySQL ODBC 5.1 Driver};port=3306;SERVER=localhost;UID=xxx;PWD=xxx;database=xxx;Option=3;charset=utf8"
I added accept-charset="UTF-8"
to all my forms.
I am running MariaDB and IIS 10.
Server version: 10.1.13-MariaDB mariadb.org binary distribution
Protocol version: 10
The page gets proxied using Apache 2.4. I am running asp (classic) code.
Calling the MySQL server for character and collation, I get this:
MariaDB> SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR
Variable_name LIKE 'collation%';
+--------------------------+--------------------+
| Variable_name | Value |
+--------------------------+--------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| collation_connection | utf8mb4_general_ci |
| collation_database | utf8mb4_general_ci |
| collation_server | utf8mb4_general_ci |
+--------------------------+--------------------+
The code worked when I was using iso-8859-1 as charset.
Any help will be very much appropriated. Thank you.
response.write(request.querystring("val")
from a URL containing the values&val=äöü
that the äöü characters are being transcoded to äöü. It's no wonder that things are not lining up. IIS 10 should have a setting for that, or I may have to code something to fix it.SELECT..HEX..
suggestion in stackoverflow.com/a/38363567/1766831 to see whether it was stored correctly or not. For correctly stored utf8, expect hexC3A4 C3B6 C3BC
foräöü
.SELECT g, HEX(g) FROM table
test turned out positive. TheCODEPAGE="65001"
declaration change did the trick for asp classic to encode in utf8. (No need to declare charset in connection string.)HEX
after dropping thecharset
from the connection string? I think they are both important, and handle radically different things.