why do i get windows-1255 message?

1 次查看(过去 30 天)
ben velt
ben velt 2015-6-3
评论: Guillaume 2015-6-4
I keep getting this message: "Warning: The encoding 'windows-1255' is not supported. See the documentation for FOPEN. > In programtry (line 3) "
this is the program:
clc,clear
fileID = fopen('List.txt','r');
dataTABLE = textscan(fileID, '%f%s%s%f%f%f%[^\n\r]', 'Delimiter', ' ', 'MultipleDelimsAsOne', true, 'HeaderLines' ,0, 'ReturnOnError', false);
fclose(fileID);
does anyone what is the problem?

回答(1 个)

Guillaume
Guillaume 2015-6-4
Your system locale must be hebrew (Windows-1255), so fopen uses that by default.
The question is: what is the encoding of the file? If it just contains plain ASCII characters, then
fileID = fopen('List.txt', 'r', 'n', 'US-ASCII');
would solve the problem.
If the file does contain some Windows-1255 characters, then the question is: is the file read properly despite the warning?
  2 个评论
ben velt
ben velt 2015-6-4
yes the file is read properly. what do you mean by the encoding of the file? the file is a regular .txt file. what does the 'US-ASCII' changes? because after I add it there isnt any error message?
Guillaume
Guillaume 2015-6-4
This page kind of explains the differences between the encodings.
Basically, standard text files (non-unicode) use single-byte characters. That only gives 256 characters which is not enough to represent the characters of every language. Therefore each locale uses its own codepage to define a set of glyph that correspond to character value. For example in Windows-1255 code page, character number 228 will be the hebrew glyph &#1492 (windows-1255), whereas in windows-1253 character number 228 is the greek glyph &#0948. In US-ASCII the same character is glyph &#228.
All code pages share the same glyphs for characters 0 to 127, so if your text file only contain these characters then the code page does not matter and use whichever you want. If the text file contains character values above 127, then these characters will look wrong if you use the wrong codepage.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by