Read file with accented characters ?

Devin Asay devin_asay at byu.edu
Fri May 19 23:03:30 EDT 2006


Zax,

Jan's advise is a good thing to try. You might also want to check  
BBEdit to see what format you're saving it in. BBEdit can save in  
Mac, Windows and Unix formats, and if you have something other than  
Mac format selected in BBEdit you may get the results you're  
describing when you open it in Rev.

You may also want to try a different approach, saving it as unicode  
from BBedit, then setting the unicodeText of the display field to the  
contents of the file. Let's say you saved it from BBEdit in Unicode/ 
UTF8 format. In Rev you would do this:

get url ("binfile:" & bbeditFileName)
set the unicodeText of fld "myFld" to uniencode(it,"utf8")

This approach has worked pretty reliably for me with Cyrillic text,  
but might be overkill for you.

HTH

Devin

> --- 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 ?

On May 19, 2006, at 11:55 AM, Jan Schenkel wrote:

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


Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list