Hi Experienced Xojo Users ,
I met a strange little problem with a multiline textfield.
When I save the content of the textfield in mysql with some ‘…’ (tree dots ) I will get from the db these characters :
???
Is it a feature or a bug ?
Thanks a lot for your precious help.
check the text encodings of the mysql database, the strings in xojo being UTF8 by default.
Norman_P
(Norman P)
June 8, 2017, 3:33pm
3
335020:@Jean-Yves Pochez:
check the text encodings of the mysql database, the strings in xojo being UTF8 by default.
When it comes from a DB or other outside source you need to make sure you use DefineEncoding
When loading from a database, you must DefineEncoding to UTF-8.
http://documentation.xojo.com/index.php/DefineEncoding
Also, before you insert the data from the text field into the database, be sure to execute this command:
db.SQLExecute("SET NAMES 'utf8'")
That tells the MySQL database that the data that is being inserted is UTF8 encoded.
Guys, just one word…thanks!
Your precious help is a plus in the Xojo Experience.
[quote=335085:@Jared Feder]Also, before you insert the data from the text field into the database, be sure to execute this command:
db.SQLExecute("SET NAMES 'utf8'")
That tells the MySQL database that the data that is being inserted is UTF8 encoded.[/quote]
do i need to do for sqlite or cubesql database
Tim_Hare
(Tim Hare)
June 9, 2017, 10:57am
8
It is only necessary if you want to view the data in another application. And sqlite has no equivalent. It is utf8 by default.
the MySql plugin returns string with nil encoding. You have to set (and use obviously “set names”)
https://www.xojoitaliablog.com/mysql-connessione/
Tim_Hare
(Tim Hare)
June 9, 2017, 11:12am
10
Does that eliminate the need for DefineEncoding? I didn’t think it did.