How can I deal with swedish words in matlab.
Mostrar comentarios más antiguos
Now when I read a .txt file with swedish words into matlab and then output it, all the swedish words became garbled. How can I make my matlab support swedish? Thanks in advance.
6 comentarios
Andreas Goser
el 8 de Mayo de 2013
Can you be more specific with what the output is? Like "Into the Command Window" or a figure?
per isakson
el 8 de Mayo de 2013
R2012a, 64bit, Windows 7,
>> str = sprintf( '%s\n', 'ÅÄÖåäö' )
str =
ÅÄÖåäö
>> double( str )
ans =
197 196 214 229 228 246 10
>>
Fang
el 13 de Mayo de 2013
Walter Roberson
el 14 de Mayo de 2013
How are you doing the reading into a variable ?
Respuestas (1)
per isakson
el 14 de Mayo de 2013
Editada: per isakson
el 7 de Jun. de 2013
Joel on Software wrote The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
A little experiment:
- I wrote "ÅÄÖåäö" in UTF-8 with Notepad++ and saved as swedish.txt
- I used fileread to read the file
>> fileread( 'swedish.txt' )
ans =
ÅÄÖåäö
>>
- I converted my text to ANSI and
>> fileread( 'swedish.txt' )
ans =
ÅÄÖåäö
Thus, I think you read from a file encoded with UTF-8.
See the documentation on fopen. With the correct setting "any" coding can be decoded.
However,
>> sprintf( '%s\n', 'ÅÄÖåäö' )
ans =
ÅÄÖåäö
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!