File Exchange: Why are some characters, such as "²", omitted in the code shown in the "Functions" tab of a file?

2 次查看(过去 30 天)
When accessing the "Functions" tab of a file in File Exchange, the code of the uploaded functions is shown. I have discovered that this code is not necessarily the actual code that was uploaded: Some characters are simply missing, such as "°" and "²". In one of my functions, this leads to faulty figure titles and documentation. Is this intended to happen?
In my experience, many people do not use the Download button to access files from File Exchange but instead simply copy and paste the code from the website via the Functions tab, either because they do not have a MathWorks account or because they are too lazy to log in. Hence I think that the code that can be copied from the website should be exactly the same as in the actual file.
Is there a list of to-be-omitted characters, or a rule that determines whether characters are omitted? Are all superscripts omitted? If this issue persists, I would like to know which characters I should avoid to use.

采纳的回答

Stephen23
Stephen23 2018-5-23
编辑:Stephen23 2018-5-23
"I would like to know which characters I should avoid to use."
If you want to write truly universal files that work for everyone, and can be stored, represented, copy-and-pasted, downloaded, etc., then avoid anything that is not ASCII:
This is the only way to guarantee a universal file, where all characters will be correctly stored and displayed, regardless of the users' settings. Yes, even on modern computers: all of the UTF encodings and various other encoding are very pretty, but if you want code that works stick to ASCII.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 String 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by