Read file with accented characters ?

Zax zax at tripoy.com
Mon May 22 03:29:18 EDT 2006


Hello Jan,
Tahnks for your help.

I tried the ISOToMac() function and it works well with BBEdit files saved in
Unix/Win format... but it also converts standard Mac text files :(

So is there a way to know how the text file was encoded before applied the
ISOToMac function ?
Something like:

open file myTextFile for read
read from file until EOF
If RevolutionTellsItsWinEncoded(it) then
    get ISOToMac(it)
else
    -- do nothing, don't translaste it
end
    
> --- Zax <zax at tripoy.com> wrote:
>> Hello,
>> 
>> I'm trying to read a text file created with BBEdit
>> on Mac OS X. This file
>> contains french accented characters.
>> Now, in my revolution script (also running on OS X),
>> whatever I use :
>> 
>> get URL ("binfile:" & bbeditFileName)
>>  or
>> get URL ("file:" & bbeditFileName)
>>  or
>> open file bbeditFileName for read
>>  or
>> open file bbeditFileName for binary read
>> 
>> the result is the same : all accented characters are
>> converted like a
>> windows text file and the "it" variable contains
>> weird text :(
>> 
>> So, what I'm doing wrong ?
>> Thanks in advance for your help.
>> ----------------------
>> Zax 
>> 
> 
> Hi Zax,
> 
> This sounds like an encoding conflict - could you try
> converting it using the macToISO() function after
> reading in the data as a binfile?
> 
>> From the docs:
> ##
> Use the macToISO function to translate data that was
> created on a Mac OS system to the ISO 8859-1 character
> set used on Unix and Windows systems.
> ##
> 
> In theory, using the URL 'file:' construct should take
> care of that, but maybe Rev needs a little nudge to
> catch this conversion.
> 
> Hope this helped,
> 
> Jan Schenkel.
> 
> Quartam Reports for Revolution
> <http://www.quartam.com>
> 
> =====
> "As we grow older, we grow both wiser and more foolish at the same time."  (La
> Rochefoucauld)
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

----------------------
Zax 





More information about the use-livecode mailing list