Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Problem reading non-ASCII text file

Subject: Problem reading non-ASCII text file

From: Yair Altman

Date: 10 Feb, 2010 01:01:07

Message: 1 of 1

Hi,

I have a text file with some non-ASCII encoding (some unknown UTF variant). When I try to open the file with some of the non-standard encodings (e.g., 'cp862' or 'ISO_8859-8') I get a warning that the encoding is not supported, although it's in the official list of IANA character sets referenced in fopen's doc page.

Example:
[fid,msg]=fopen(f,'rt','native','ISO_8859-8');
=> Warning: The encoding 'ISO-8859-8' is not supported.
line = textscan(fid,'%s',1, 'delimiter','\n');
str = line{1}{1};
disp(str)
=> '73 ' + gibberish
double(str)
=> [55 51 9 1523 156 1523 8221 1523 8216 32]

When reading the same data from Excel, it loads correctly as: [55 51 9 1500 1492 1489] and displays the three special characters (1500,1492,489) correctly in the font that I use.

Any idea how to fix this encoding issue for text files?

Thanks,
Yair

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us