creating a Unicode (UTF-8) file using open/write/close file
Trevor DeVore
lists at mangomultimedia.com
Fri Sep 26 23:21:00 EDT 2003
Dar,
That did it! The following code create a file that was read as a UTF8
file by BBEdit:
on mouseUp
set useUnicode to true
put "/Users/trevordevore/Desktop/config.xml" into tPath
open file tPath for binary write
write uniDecode (bom() & the unicodeText of field 1, "UTF8") to file
tPath
close file tPath
end mouseUp
function bom
set the useUnicode to true
return numToChar(abs(baseConvert("FEFF",16,10)))
end bom
Thanks!
--
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com
On Friday, September 26, 2003, at 05:52 PM, Dar Scott wrote:
>
> On Thursday, September 25, 2003, at 08:38 AM, Trevor DeVore wrote:
>
>> I get a file that Flash MX reads without a problem. BBEdit still
>> doesn't recognize it but I will mess around with adding the BOM to
>> the file and see if that helps. Now I just need to find a way to get
>> file paths in unicode and I will have a unicode friendly application.
>
> Try putting the BOM before the unicode and then convert to UTF-8.
>
> (BTW, as you probably noticed, I got the bytes swapped in my earlier
> suggestion for creating the BOM. The principle still might work.
>
> function bom
> set the useUnicode to true
> return numToChar(abs(baseConvert("FEFF",16,10)))
> end if
>
> Or something like that.
>
> Or simply use the three byte UTF-8 version.)
>
> Dar Scott
> unicode sophomore
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list