help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with file encoding


From: krthie
Subject: Re: Problems with file encoding
Date: Mon, 17 Oct 2011 17:15:13 -0700 (PDT)

Hi

I stumbled on the problem mentioned in this old thread myself: I need to
read a file with a specific encoding. Jordi wrote


Jordi GutiƩrrez Hermoso-2 wrote:
> 
>  I don't think there is a
> way to make Octave guess the encoding, but perhaps it could possibly
> be told what the encoding is. That's a development I don't
> particularly want to undertake myself, though.
> 

In matlab, I open my files with the specific encoding (see 
http://www.mathworks.co.uk/help/techdoc/ref/fopen.html
http://www.mathworks.co.uk/help/techdoc/ref/fopen.html ), for example


> fid= fopen(inputFilename,'rb','b','ISO-8859-1');
> 

Octave unfortunately doesn't support the 4th argument to fopen. It is
probably a major exercise to get it supported. I guess this means using
locales etc. In attempt to get a volunteer going I've had a look at the
documentation for glibc:



> If the opentype string contains the sequence ,ccs=STRING then STRING is
> taken as the name of a coded character set and fopen will mark the stream
> as wide-oriented which appropriate conversion functions in place to
> convert from and to the character set STRING is place. Any other stream is
> opened initially unoriented and the orientation is decided with the first
> file operation. If the first operation is a wide character operation, the
> stream is not only marked as wide-oriented, also the conversion functions
> to convert to the coded character set used for the current locale are
> loaded. This will not change anymore from this point on even if the locale
> selected for the LC_CTYPE category is changed. 
> 
However,msdn's documentation for fopen is slightly different, so how
portable this is, I don't know...

Kris

--
View this message in context: 
http://octave.1599824.n4.nabble.com/Problems-with-file-encoding-tp3514439p3913864.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]