From: Tom on
Hello,

I try to read text using fscanf :

copyfile([adresse,'donnees.xml'],[adresse,'donnees.txt'])
fid = fopen('donnees.txt');
= fscanf(fid,'%c');

Since text is in french I get accent problem example this part of the text :
"Bulletin hydrométéorologique"
becomes : "Bulletin hydrométéorologique"

problems are for all : à , é , ' , ô , î, è

Source of the problem could be that 'donnees.txt' was originaly a XML
because if I mnually copy some text in another TXT then that second one yeilds no problems...

Thank you for your time
From: Tom on
Just realised that my encoding is 'UTF-8' so i now just have to find how to open a txt in ''UTF-8''
fid = fopen('donnees.txt','UTF-8');
this gives me : ??? Error using ==> fopen
Invalid permission.
From: Walter Roberson on
Tom wrote:
> Just realised that my encoding is 'UTF-8' so i now just have to find how
> to open a txt in ''UTF-8''
> fid = fopen('donnees.txt','UTF-8');
> this gives me : ??? Error using ==> fopen
> Invalid permission.

fid = fopen('donnees.txt', 'rt', 'UTF-8');

I think it likely that if you were to use

fid = fopen('donnees.txt', 'rt')

that it would automatically detect that the file was UTF-8. When you
leave out the 't' the assumption is that you are opening a binary file,
which Matlab would read byte by byte instead of encoded-character by
encoded-character.