Japanese (unicode?) text problem

Tim Selander selander at tkf.att.ne.jp
Wed Sep 21 01:30:17 EDT 2016


Hi Nicolas,

Finally something I can answer!

I have found that you need to use 'open file' because that let's you 
specify the file's encoding.

Assume the path to your file is in tFile, these lines should work:

       open file tFile for utf8  read
       read from file tFile until end
       put it into fld "indices"
       close file tFile

If there is a more elegant way, I'm sure the pros will chime in!

Tim Selander
Tokyo, Japan
	

On 2016/09/21 13:30, Nicolas Cueto wrote:
> ​With Notepad++​, created a new file, pasted English and Japanese text, set
> encoding to UTF-8,  then saved as .txt. (Confirmed the file by opening with
> Windows' "Notepad".)
>
> Next, in LC8.1 ran this button script:
>
> on mouseUp
>     put empty into field "indices"
>     set the itemdel to quote
>     put item 2 of the long name of this stack into tDataPath
>     set the itemdel to "/"
>     delete the last item of tDataPath
>     put "/Data/bilingual.txt" after tDataPath
>     put "file:" & tDataPath  into tURL
>     put url tURL into field "indices"
> end mouseUp
>
> The text appears in the field, but with Japanese text garbled.
>
> What am I doing wrong?
>
> Thanks.
>
> --
> Nicolas Cueto
> _______________________________________________
> 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