Sample Header Ad - 728x90

MySQL/MariaDB connection in asp code encodes wrongly charset utf8 at insert or update in data base

1 vote
1 answer
1917 views
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.
Asked by MeSo2 (143 rep)
Aug 31, 2016, 05:56 PM
Last activity: Feb 12, 2025, 10:08 AM