Unicode anyone ?...

Tim Selander selander at tkf.att.ne.jp
Mon Sep 23 04:46:55 EDT 2013


I can't tell you definitively because I am barely hanging on by a 
thread when it come to understanding LC's usage of unicode...

After a GREAT deal of poking around on this list, other forums 
and Google, this is what I've come up with to retrieve UTF8 from 
mySQL. In my case, my mySQL field names are also UTF8 (Japanese) 
so I'm not sure if my problems were due to that or to simply 
retrieving UTF8 data.

Here is my basic script:
--magic command for UTF8/mySQL, from forum user "bancock
--without this I cannot send or receive UTF8 from mySQL
-- vDatabaseID is of course the id number returned when you 
successfully
--connect to the database
--I issue this command at the top of every script that retrieves 
data from mySQL
    revExecuteSQL vDatabaseID, "SET NAMES 'utf8'"


--fld "query" contains SQL query, English & Japanese text, since 
LC's lame
--editor will not let me type in UTF8/Japanese words
    put the unicodeText of field "query" into locSQLParams
    put uniDecode(locSQLParams, "UTF8") into locSQLParams

--fld "queryresults" holds data returned by mySQL
--Works great; get a field that holds the returned English and 
Japanese
    set the unicodetext of fld queryresults to 
uniEncode(myResult, "UTF8")

You'll need to figure out your own chunking and parsing from here....

As I recall, "put" caused grief, so I've ended up using "set" -- 
see if that works for you first. Then, try the "magic command" 
which I found on a forum; though this might only be needed if you 
have UTF8 field names?

Good Luck

Tim Selander
Tokyo, Japan


On 9/23/13 5:16 PM, John Dixon wrote:
> I have for example 'cafés' coming out of a mySQL database, but when it
> is put into an LC Field it is all messed up... 'cafEs' (with the accent
> on top of the 'E' pointing in the wrong direction...
>
> put item theItem of thisLine into theIndexNameset the unicodeText of fld 1 of group count of group "setGroup" to uniEncode(theIndexName,"UTF-8")
>
> anyone tell me what I'm doing wrong ? 		 	   		
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>





More information about the use-livecode mailing list