in LC 6.6.2, Mac OS X Maveriks, calling data from MySQL dBase on our web server into a desktop thin client.

I have a field that is being set to unicode... the default font is Lucida Grande, which supports Tamil.

I'm on a mac: if I paste Inaimathi (Tamil Unicode font) into the field, the Tamil script appears as expected, if I go to PHPMy Admin log into our webserver and look at a field with lyrics and copy and paste into my livecodes stack (or email or pages) it all works... I get Tamil script


but if I fetch that same field as JSON... I get raw unicode from our web serve (the use case is lyrics for songs)

and put it into var tJSON

I get something like this which I can push to the message box:

put tJSON

[
{"lyrics_id":"1",
"song_title":"Anbar Anbathu",
"original_script":"\u0b85\u0ba9\u0bcd\u0baa\u0bb0\u0ba9\u0bcd\u0baa\u0ba4\u0bc1 \r\n\r\n\u0b85\u0ba9\u0bcd\u0baa\u0bb0\u0ba9\u0bcd\u0baa\u0ba4\u0bc1 \u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\r\n\u0b86\u0b9a\u0bc8\u0baf\u0bb1\u0bcd\u0bb1\u0ba4\u0bc1 \u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\r\n\u0b87\u0ba9\u0bcd\u0baa\u0bae\u0baf\u0bae\u0ba4\u0bc1 \u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\r\n\u0b88\u0b9a\u0ba9\u0bc1\u0baf\u0bbf\u0bb0\u0bcd\u0ba4\u0bca\u0bb1\u0bc1\u0b9e\u0bcd \u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\r\n\r\n\u0bae\u0bc1\u0ba9\u0bcd\u0baa\u0bbf\u0ba9\u0bcd \u0b85\u0bb1\u0bcd\u0bb1\u0ba4\u0bc1
[snip]
u0bb0\u0bc2\u0baa\u0b9e\u0bcd \u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\r\n\u0bb5\u0bbf\u0ba3\u0bcd\u0ba3\u0bbf\u0b9f\u0ba4\u0bcd\u0ba4\u0ba4\u0bc1 \u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\r\n\u0bb5\u0bc7\u0ba4\u0bae\u0bbe\u0ba9\u0ba4\u0bc1 \u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\r\n\r\n\u0bae\u0b9f\u0bcd\u0b9f\u0bbf\u0bb2\u0bbe\u0ba4\u0ba4\u0bc1 \u0b9a\u0bbf\u0bb5", "transliteration":"Anbar Anbathu\r\n\r\nanbar anbathu sivasivasiva\r\naasaiy attrathu sivasivasiva\r\ninbamayam athu sivasivasiva\r\neesan uyirthorum sivasivasiva\r\n\r\nmun pin attrathu sivasivasiva\r\nmohnam muthalathu sivasivasiva\r\nthanvayathathu sivasivasiva\r\nsarva vallapam sivasivasiva\r\n\r\nponniratthathu sivasivasiva\r\npohk illaathathu sivasivasiva\r\nen idatthathu sivasivasiva\r\nengum ullathu sivasivasiva\r\n\r\nman idatthathu sivasivasiva\r\nmanthira roopam sivasivasiva\r\nvin idatthathu sivasivasiva\r\nveytham aanathu sivasivasiva\r\n\r\nmattilaathathu sivasivasiva\r\nmangai pangathu sivasivasiva\r\nmuttilaathathu sivasivasiva\r\nmoovar aavathu sivasivasiva\r\n\r\nkittonaathathu sivasivasiva\r\nkirupay ullathu sivasivasiva\r\nettil aanathu sivasivasiva\r\neygam aanathu sivasivasiva\r\n\r\nannaiy aavathu sivasivasiva\r\nappan aavathu sivasivasiva\r\nmunnaiyullathu sivasivasiva\r\nmunivar pugal.vathu sivasivasiva\r\n\r\nennai aalvathu sivasivasiva\r\neduttha thiruvadi sivasivasiva\r\npinnai en pil.ai sivasivasiva\r\npeythaapeytham sivasivasiva\r\n\r\n",
"literal_translation":null,
"production_notes":null
}
]

so far so good...Now bhow to get strings like:

\u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\r\n\r\n\u0bae\u0bc1\u0ba9\u0bcd\u0baa\u0bbf\u0ba9\u0bcd \u0b85\u0bb1\u0bcd\u0bb1\u0ba4\u0bc1

to appear as Tamil in the same liveCode field where I can paste it...and get proper script?

Now.. I have included libJSON (Mark Smith) in my stack and if I take the above

and do this:

put jsonToArray(tJSON, true) into tLyricsA
put tLyricsA[1] into sLyricsA

# OK now the among the keys are one "original_script", which as you can see above is coming in as raw unicode...
# but

put sLyricsA["original_script"] into tContent
put tContent

things get strange:

I get this in the msg box

…©Íª°©Íª€Á



…©Íª°©Íª€Á ¿µ¿µ¿µ

†ȯ±Í±€Á ¿µ¿µ¿µ

‡©Íª®¯®€Á ¿µ¿µ¿µ

ˆ©Á¯¿°Í€Ê±ÁˇÍ ¿µ¿µ¿µ

[snip, more garbage)

and if I do:

set the text of field "lyrics" to unidecode(tContent, "utf8")

we get this in the field:

ÍßâÎؙͶ°ÎØ™Óüõ‡¥†‡¥äϧäÓ™©Íܪә©Ìƪ‚ÉßÏÄÇ µÎóÄÏÄLJ∂µÍÄäÓ§ÇÎá∏Îá™Ó

So... to test and remove the JSONtoARRay function out of the equation...

I made this little button, then copy the unicode "\u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\u0b9a\u0bbf\u0bb5\r\n\r\n\u0bae\u0bc1\u0ba9\u0bcd\u0baa\u0bbf\u0ba9\u0bcd \u0b8 etc" to my clipboard

on mouseUp
put the clipboardData["text"] into tContent
set the unicodetext of fld "lyrics" to unidecode((tContent,"utf8") #outputs garbage:

郧莽釧ꖹ뇢ꊔ駦뢈


set the unicodetext of fld "lyrics" to uniencode(tContent,"utf8") # returns the clipboard untouched:

"\u0b85\u0ba9\u0bcd\u0baa\u0bb0\u0ba9\u0bcd\u0baa\u0ba4\u0bc1...etc"

What am I doing wrong?


Swasti Astu, Be Well!
Brahmanathaswami

Kauai's Hindu Monastery
www.HimalayanAcademy.com


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to