Problems with accentuation and MariaDB.
I noticed that when the data is entered and read directly by Purebasic using the new MariaDB library the data is written and retrieved with accents correctly, however, when I try to read some previously fed database, I can not recover with the correct accent.
Would anyone know of something to do to also be able to use PureBasic on previously powered databases?
thanks for listening!
accentuation and MariaDB
- holzhacker
- Enthusiast
- Posts: 123
- Joined: Mon Mar 08, 2010 9:14 pm
- Location: "Mens sana in corpore sano"
- Contact:
Re: PB 5.70 B4 - accentuation and MariaDB
Was you database using an ASCII encoding ? We expect UTF8 IIRC
- holzhacker
- Enthusiast
- Posts: 123
- Joined: Mon Mar 08, 2010 9:14 pm
- Location: "Mens sana in corpore sano"
- Contact:
Re: PB 5.70 B4 - accentuation and MariaDB
The database of this application (it is third party) is with Default Collation: latin1 - default collation, in the database and in the tables.Fred wrote:Was you database using an ASCII encoding ? We expect UTF8 IIRC
I made a change to: utf8_general_ci but unsuccessfully.
If there is any way to properly recover using the new library thank you for suggestions.
I would like to inform you that the constant #PB_Database_MySQL is referenced in the OpenDatabase help, but it is not defined.
Re: PB 5.70 B4 - accentuation and MariaDB
I don't know MariaDB but i think changing the collation doesn't convert your data. Also collation is for sorting etc. and the encoding of the data is flagged by character set instead. And changing the character set and converting the actual data in the database are 2 different things.
-
- PureBasic Expert
- Posts: 2810
- Joined: Fri Apr 25, 2003 4:51 pm
- Location: Portugal, Lisbon
- Contact:
Re: PB 5.70 B4 - accentuation and MariaDB
For future reference (almost 2 years too late ).
You can solve this by this with a simple a query every time you connect to the database for the 1st time (or disconnect and reconnect):
All queries after this will output correctly.
I tested with a converted to latin1 to utf8 database, that had the same problem, and it works. You can also set it to latin1
You can solve this by this with a simple a query every time you connect to the database for the 1st time (or disconnect and reconnect):
Code: Select all
query.s = "SET NAMES 'utf8' COLLATE 'utf8_general_ci';"
I tested with a converted to latin1 to utf8 database, that had the same problem, and it works. You can also set it to latin1
Code: Select all
query.s = "SET NAMES 'latin1' COLLATE 'latin1_swedish_ci';"