Page 1 of 1

accentuation and MariaDB

Posted: Sat Dec 15, 2018 3:27 pm
by holzhacker
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!

Re: PB 5.70 B4 - accentuation and MariaDB

Posted: Mon Dec 17, 2018 10:55 am
by Fred
Was you database using an ASCII encoding ? We expect UTF8 IIRC

Re: PB 5.70 B4 - accentuation and MariaDB

Posted: Mon Dec 17, 2018 10:29 pm
by holzhacker
Fred wrote:Was you database using an ASCII encoding ? We expect UTF8 IIRC
The database of this application (it is third party) is with Default Collation: latin1 - default collation, in the database and in the tables.

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

Posted: Tue Dec 18, 2018 11:47 am
by #NULL
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.

Re: PB 5.70 B4 - accentuation and MariaDB

Posted: Wed Oct 28, 2020 11:26 am
by Num3
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):

Code: Select all

query.s = "SET NAMES 'utf8' COLLATE 'utf8_general_ci';"
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

Code: Select all

query.s = "SET NAMES 'latin1' COLLATE 'latin1_swedish_ci';"