sending a utf8 query to MySQL from LiveCode stack
Tim Selander
selander at tkf.att.ne.jp
Fri Apr 12 10:55:17 EDT 2013
Starting to work with LC with a MySQL database on my on-rev.com
account. Got the database, user, table etc. made and imported all
my data using phpMyAdmin and can use the database with phpMyAdmin.
For testing purposes, I made some of the column names Japanese
and some English. (Ideally, I would like all column names to be
in Japanese utf8.)
Everything works fine on phpMyAdmin, that is searching for
Japanese data using the Japanese column names works fine.
On my stack, I have a fld "query" that has
SELECT *
FROM `tablename`
WHERE `県` LIKE '東京'
LIMIT 0 , 30
when I put that in a variable to send to the server, the variable
replaces the kanji characters with "?" -- whether the kanji is in
the column name, or in the data to search for -- and of course
the search fails.
on mouseUp
global vDatabaseID
set useunicode to true
revExecuteSQL vDatabaseID, "SET NAMES 'utf8'"
put fld query into dbsql
put revDataFromQuery(, , vDatabaseID, dbSQL) into myResult
put uniencode(myResult,"UTF8") into tData
set the unicodetext of field "queryresults" to tData
end mouseUp
<put uniencode(fld query, "UTF8") into dbsql> doesn't work either
How do I get the kanji/utf8 into a variable correctly?
Can anyone give me a pointer?
Thanks,
Tim Selander
Tokyo, Japan
More information about the use-livecode
mailing list