Arabic document
4 ビュー (過去 30 日間)
古いコメントを表示
Hello Everyone. Please, I want to know if you can read Arabic document in matlab. Arabic is install on my computer, and when I try to read the file it gives me: {'المملكة' 'المغربية'} is that you have an idea please??
0 件のコメント
採用された回答
Walter Roberson
2011 年 4 月 28 日
How are you reading the file, and how are you displaying it? What is your locale set to? What is your font set to?
3 件のコメント
Walter Roberson
2011 年 4 月 28 日
It doesn't help to say "Its not working". Please show the first line of the output of dec2hex(0 + doc{1}) and indicate the unicode code points for the first 16 or so characters you are expecting in the file. Also, please change your 'r' option to 'rt' so that you are working with text instead of binary.
Please also execute this and indicate the output:
fid = fopen('arabe.txt','r');
dec2hex(0 + fread(fid, 32, '*uint8'));
fclose(fid);
Walter Roberson
2011 年 4 月 28 日
If that is the entire output, then your file is only 5 bytes long. I need a longer sample than that to debug this problem.
I also still need the first line of the output of dec2hex(0 + doc{1}), and the first few unicode code points of what you are expecting. Unfortunately this forum is not able to support posting arabic directly so you will have to look up the characters in the wikipedia article I referenced and write them down manually.
その他の回答 (6 件)
Walter Roberson
2011 年 4 月 28 日
If I am correct about the file having been double-encoded, then:
fid = fopen('arabe.txt','r');
inputtext = char(native2unicode(fread(fid)));
fclose(fid)
21 件のコメント
Walter Roberson
2011 年 5 月 6 日
It appears that najmaf changed the Windows Regional Language settings.
najmaf najma
2011 年 4 月 28 日
1 件のコメント
Walter Roberson
2011 年 4 月 28 日
I needed you to use
fid = fopen('arabe.txt','r');
dec2hex(0 + fread(fid, 32, '*uint8'));
fclose(fid);
You used 'rt' instead. I don't know if that makes a difference.
najmaf najma
2011 年 4 月 28 日
2 件のコメント
Walter Roberson
2011 年 4 月 28 日
Yes, and I need to see _what_ those hexadecimal values are.
Wait -- is the first character of the file 0x0627, 'alif ? If so, then the file appears to be a UTF-8 encoding of a UTF-16 byte stream. The file appears to have been encoded twice!
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!