creating a Unicode (UTF-8) file using open/write/close file

Kenji Kojima index at kenjikojima.com
Wed Sep 24 19:16:01 EDT 2003


Hi Trevor,

> open file tPath for write (also tried open file tPath for binary write)
> write unicodeText of field 1 to file tPath
> close file tPath
>
> The Japanese characters were turned into garbage characters when I 
> opened the file in BBEdit.  Is it possible to write a UTF encoded text 
> file with Rev?  If so, how?

If you like to save Japanese as UTF16, use this.

on mouseUp
   ask file "" with "untitled.txt"
   put "binfile:" & it into tURL
   if the platform is "MacOS" then
     put "ž" & unicodeText of fld 1 into tData  -- you may not see "ˇı"
   else
     if the platform is "Win32" then
       put "ÿþ" & unicodeText of fld 1 into tData
     end if
   end if
   put tData into URL(tURL)
end mouseUp

It's by Kiyoshi Kamogawa of Japanese mailing list.
I cannot open this file in BBEdit Lite which I have, but can open in 
TextEdit on MacOSX
or Hidemaru editor on Windows. I do not know how I can save Japanese 
text as UTF8.

Rev unicode field still has problems.
We've been expecting the next version since last year.

--
Kenji Kojima
http://www.kenjikojima.com/






More information about the use-livecode mailing list