opening txt files

Robert Sneidar slylabs13 at me.com
Wed Jan 16 13:56:42 EST 2013


I did not see an RTF export option in Pages. Besides, I think he is dealing with reading text files, the nature of which he does not control. 

Bob


On Jan 16, 2013, at 9:22 AM, Richmond wrote:

> 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.
> 
> _______________________________________________
> 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