Why can't read german umlauts from a .txt file?
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
prjctdth
el 10 de En. de 2017
Comentada: prjctdth
el 16 de En. de 2017
I need to read german text from a file and translate it into ascii-numbers. Of course it contains german umlauts 'ä', 'ö', 'ü' and the character 'ß' as well. After using fscanf my resulting string contains only the '?', where these chars were. Changing the encoding in Matlab doesn't work. Is it an issue with my operating system Mac OS? Here is a simple example:
fileID = fopen('text.txt','r');
string = fscanf(fileID,'%s');
and the content of my text.txt for testing:
Lorem ipösum dolor! sit am?et, consüetetur{ sadip$sciäng e&litr, sßed.
All the other special characters are read fine. The result is
string =
loremip?sumdolor!sitam?et,cons?etetur{sadip$sci?nge&litr,s?ed.
P.S. The removement of white space is alright in my application.
0 comentarios
Respuesta aceptada
Vishal Neelagiri
el 16 de En. de 2017
I tried reproducing the issue that you are facing but I was able to successfully read all the german umlauts from the .txt file. In my case,
string =
Loremipösumdolor!sitam?et,consüetetur{sadip$sciänge&litr,sßed.
I am using MATLAB R2016b on a Windows 10 machine. Your issue seems to be related to your operating system. You might want to refer to this MATLAB Answers page which addresses a similar issue:
https://www.mathworks.com/matlabcentral/answers/100749-why-am-i-unable-to-visualize-umlaut-characters-a-o-u-in-uicontrol-objects-when-i-use-a-german-keyb
Más respuestas (0)
Ver también
Categorías
Más información sobre Language Support en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!