Handling Thai characters...

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Handling Thai characters...

Post by paulsr » Wed Oct 09, 2013 10:00 am

Hi ... I'm trying, and failing, to display Thai characters in an app, and would much appreciate some guidance.

First I went to Google Translate so that I could create some Thai text. This I pasted into Wordpad and saved as "Unicode Text Document".

That seems to have worked because I can open the same document in OpenOffice Writer and I see the correct text. I did this in WindozeXP. If I open the file with TextEdit on a Mac, it also looks correct.

Then I tried to read that text into LC. My code looks like this:

Code: Select all

put "binfile:" & specialFolderpath("documents") & "/thai.txt" into tThai
put url tThai into tThaiText
set the unicodetext of fld "somefield" to uniencode(tThaiText,"UTF8")
What I see is a jumble of line drawing characters, musical notes, plus a few numbers. If I run the same app on a Mac, I see a string that looks like "5 L P 7"...etc.

Did I miss a step?

Many tkx...

--paul

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Handling Thai characters...

Post by bangkok » Wed Oct 09, 2013 10:35 am

No need to uniencode your file because it is already in unicode.

So here is the script :

Code: Select all

put "binfile:" & specialFolderpath("documents") & "/thai.txt" into tThai
put url tThai into tThaiText
set the unicodetext of fld "somefield" to tThaiText

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: Handling Thai characters...

Post by paulsr » Wed Oct 09, 2013 11:19 am

bangkok wrote:No need to uniencode your file because it is already in unicode.
That makes sense. Many thanks...

--paul

Post Reply