Greek character in script turned to a square or a question mark - any ideas why?
조회 수: 8 (최근 30일)
이전 댓글 표시
I copied a script from an older computer with Matlab 2012b to a new computer with Matlab 2017a and when I opened it, a Greek character 'μ' was encoded as a little square (maybe missing font). After Installing the Greek language option in MS Windows and typing in its place the letter μ, running the script reported an error (wrong matrix dimensions). So I reloaded the saved script and the character μ had now been replaced by a questionmark. Does anyone know what is going on? I have not witnessed this before. The faulty character encoding may have nothing to do with Matlab itself.
댓글 수: 0
답변 (3개)
maiaL
2020년 8월 3일
You can refer to this if you want to print greek and other special characters. But I don't think you can have these characters within the code itself.
댓글 수: 0
Walter Roberson
2020년 8월 4일
편집: Walter Roberson
2020년 8월 4일
R2020a is the first release that handles UTF8 encoding in a way that is natural to the user.
In releases before that, you had to use hacks and obscure calls to tell MATLAB that you were going to use non-ASCII. And on your new computer, you have not used those obscure settings.
My recommendation would be to upgrade to R2020a.
댓글 수: 4
Walter Roberson
2020년 8월 7일
while infoHeadr (pe) ~='μ'
pe=pe+1;
That code runs off the end of array if the character is never found.
Unrecognized utf8 for μ would be interpreted as a pair of bytes, at least one of which was non-printable. That would then be comparing two different characters to each array entry, which is guaranteed to fail because no one value can be equal to two different things. If you use a good programming editor you can ask to see all the bytes rendered to see what is stored there. https://superuser.com/questions/558781/show-hexadecimal-ascii-codes-on-notepad-6-3
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!