opening txt files

Richmond richmondmathewson at gmail.com
Wed Jan 16 12:22:36 EST 2013


On 01/16/2013 07:15 PM, Nishok Love wrote:
> Thanks, Bob. Your command works but the same results occur. Further investigations here found this
>
> When Pages is used to export as "Text", the resulting file may be of two kinds:
>
> (1) if the document contained only characters included in Apple MacRoman charset, the file is a pure text file based on Apple MacRoman encoding.
>
> (2) if the document contained extraneous characters the created text file take care of this feature and uses the UTF encoding (two bytes per character) and starts with the logical BOM: "FE FF".
>
> which I've copied from the discussion on  https://discussions.apple.com/message/9518841?messageID=9518841#9518841?messageID=9518841
>
> Opening both files with TextEdit (which displays both of them correctly, ie without all those extra spaces), duplicating them and then watching the save options shows that one file (the one from Pages) is using UTF-16 whilst Word's Western (Mac OS Roman) export is in UTF-8. Using GetInfo I can now see that the UTF-16 file is twice the size of the other.
>
> In short, text files are not as simple as they used to be!
>
> So I'm still looking for a way for LiveCode to spot whether it's opening a file in UTF-8 or UTF-16 (or something else - aaarrgh!). Can I access the file header? read from file just gives me the data...
>
> I could read the file, count the number of characters and how many of them are spaces and from that I could infer which format is being used. Probably this would be reliable for my purposes - just not very elegant!
>
> Nishok
>
>
>
  Why not use RTF?

Richmond.




More information about the use-livecode mailing list