Display error(encoding)

34 visualizaciones (últimos 30 días)
Dick
Dick el 30 de Dic. de 2023
Comentada: Dick el 3 de En. de 2024
Hello community!
recently, I met a problem. When I open my matlab files, the chinese character became "?????", by using script feature('locale') and I think related problem is :
ctype: 'en_US.windows-1252'
collate: 'en_US.windows-1252'
time: 'en_US.windows-1252'
numeric: 'en_US_POSIX.windows-1252'
monetary: 'en_US.windows-1252'
messages: 'en_US.windows-1252'
encoding: 'windows-1252'
terminalEncoding: 'GBK'
jvmEncoding: 'Cp1252'
status: 'MathWorks locale management system initialized.'
warning: 'System locale setting, zh_CN, is different from user locale setting, en_US.'
Clearly, something went wrong. How can I fix this in matlab?

Respuesta aceptada

Hassaan
Hassaan el 30 de Dic. de 2023
Editada: Hassaan el 30 de Dic. de 2023
Way 1- Change MATLAB's Locale Settings to Chinese: You need to change MATLAB's locale settings to one that supports Chinese characters, like GBK or UTF-8. This can be done by setting the locale to zh_CN (for Simplified Chinese) or zh_TW (for Traditional Chinese). You can set the locale in MATLAB using the command:
feature('DefaultCharacterSet', 'UTF-8');
After running this command, restart MATLAB and see if the issue is resolved.
Way 2- Set the System Locale to Match MATLAB's: If the MATLAB fix alone doesn't work, you may also need to adjust your system's locale settings to match MATLAB's. This involves changing the system locale to Chinese through the Control Panel in Windows. After changing the system locale, you may need to restart your computer.
Way 3- Use Unicode-Encoded Files: When saving files that contain Chinese characters, make sure to save them with Unicode encoding (such as UTF-8). When you open a file in MATLAB, specify the encoding if necessary. For example:
fid = fopen('filename.txt', 'r', 'n', 'UTF-8');
Way 4- Check Your Fonts: Ensure that the font you're using in MATLAB supports Chinese characters. You can change the font from the MATLAB preferences.
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
  3 comentarios
Hassaan
Hassaan el 2 de En. de 2024
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems
  • Electrical and Electronics Engineering
Dick
Dick el 3 de En. de 2024
Thank you, pal.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.

Productos


Versión

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by