How can I deal with swedish words in matlab.
3 views (last 30 days)
Show older comments
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 Comments
Answers (1)
per isakson
on 14 May 2013
Edited: per isakson
on 7 Jun 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 =
ÅÄÖåäö
0 Comments
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!