MATLAB Answers

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

1 view (last 30 days)
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.

  0 Comments

Sign in to comment.

Accepted Answer

Stephen Cobeldick
Stephen Cobeldick on 23 May 2018
Edited: Stephen Cobeldick on 23 May 2018
"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.

More Answers (0)

Products


Release

R2018a

Translated by