MariaDB /MySQL returns ? instead of ë In PureBasic
Posted: Sat Jan 10, 2026 1:23 pm
Hi
I have a connection with my local MariaDB database. One of the columns returns "Belg?" instead of "België" in PureBasic.
The collation is "utf8_bin" already changed from "utf_general_ci".
I'm on Linux Ubuntu 22.04
In phpMyAdmin the value is "België".
result of the debugging, the value is already corrupted before using it in the application:
Belgi?
Type= 2 Naam= Land
Connection is made with:
UseMySQLDatabase()
If OpenDatabase(#Database, "host=localhost port=3306 dbname='NameDB'", "root", "",#PB_Database_MySQL)
piece of the code:
What am I doing wrong here?
Many thanks in advance,
Rudi
I have a connection with my local MariaDB database. One of the columns returns "Belg?" instead of "België" in PureBasic.
The collation is "utf8_bin" already changed from "utf_general_ci".
I'm on Linux Ubuntu 22.04
In phpMyAdmin the value is "België".
result of the debugging, the value is already corrupted before using it in the application:
Belgi?
Type= 2 Naam= Land
Connection is made with:
UseMySQLDatabase()
If OpenDatabase(#Database, "host=localhost port=3306 dbname='NameDB'", "root", "",#PB_Database_MySQL)
piece of the code:
Code: Select all
While NextDatabaseRow(#Database) ; as long as there are records
Record$=""
For i = 0 To DatabaseColumns(#Database) ;get columns
KolomType$ = Str(DatabaseColumnType(#Database, i))
KolomNaam$ = DatabaseColumnName(#Database,i)
RawValue$ = GetDatabaseString(#Database,i)
If KolomType$= "2" ; type = text
EscapedValue$ = ReplaceString(RawValue$, "ë", "ë") ; Voor voorbeeld, escape 'ë' ; this does not work because the value is already "?"
Debug EscapedValue$
Else
EscapedValue$ = RawValue$
EndIf
Record$ =Record$ + Chr(10) + EscapedValue$;GetDatabaseString(#Database, i) ;gegevens ophalen
Debug "Type= " + KolomType$ + " Naam= " + KolomNaam$
; Break stops after first column
Next
AddGadgetItem(#frmKlanten_lstKlanten,-1,Record$) ;lijn met gegevens toevoegen
RecordCount.i = RecordCount.i + 1
Break ; stops after first record
WendMany thanks in advance,
Rudi