How can I change the default character encoding? (MATLAB R2013b, Mac OSX)

124 views (last 30 days)
Hello, I wanna use ISO-8859-1 encoding to be able to use Swedish characters like å,ä and ö. I read that MATLAB reads the default character encoding from the user settings in Mac OS. But I wanna use English in my OS, and just want to change the encoding in MATLAB.
feature('DefaultCharacterSet') returns US-ASCII by default.
When I try to change to ISO-8859-1 with feature('DefaultCharacterSet', 'ISO-8859-1') and check again with feature('DefaultCharacterSet') i get ISO-8859-1 , but I still cant use the swedish characters.
for instance:
disp('åäö') returns nothing, and
disp('hello åäö hello') returns hello hello
[EDIT]
I made it work when i created startup.m with feature('DefaultCharacterSet','ISO-8859-1'), although I still cant open directories (folders) with Swedish letters. I get the error: E rror using cd, (Name is nonexistent or not a directory)
Does this not depend on character encoding? Again, this is not a problem when I use Swedish language in OSX.

Answers (1)

Walter Roberson
Walter Roberson on 4 Dec 2013
Open the system Language and Text preference. In the Input Sources area, select Swedish and whichever English you prefer (e.g., Canadian English for me.) In the system Keyboard preferences, you might want to tick on the bottom box, "Show Keyboard & Character Viewers in menu bar".
You should now have a little on the top menu bar, probably just to the left of the time. Click on it and on the drop-down menu that comes up, click on whichever keyboard you want to use. If you are not sure where the characters are, open the keyboard viewer from that same menu.
I am using ISO-8859-1 with English for my OS, and I can switch to other languages (including Swedish, I tested) when I want to.
In the system Language Preferences, in that last tab, the one that allows you to select keyboards, you might need to click the radio button to allow different encodings for each document. I have it set to use the same encoding, but then my default is ISO-8859-1 rather than US-ASCII
  11 Comments
Walter Roberson
Walter Roberson on 23 Jan 2021
@Ivan Mich Are you using MacOS Mavericks like was being discussed above? Are you using Windows 10 1306, prior to Windows 10 Creator Edition? Are you using Windows 10 20H2 ? One of the linuxes ?

Sign in to comment.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!