Incorrect Emoji while using "fileread" from json file
조회 수: 8 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2020년 11월 10일
답변: MathWorks Support Team
2021년 2월 1일
Why am I getting incorrect Emoji while using "fileread" from JSON file?
I am using MATLAB R2019a version.
채택된 답변
MathWorks Support Team
2020년 11월 10일
'Fileread' uses a system-dependent encoding, which interprets the character differently on different platforms.
To get around this, you can instead call 'fopen'
>> fid = fopen(filename,'r','n','utf-8')
>> data = fread(fid,'*char')';
>> fclose(fid);
This should work, assuming the data is UTF-8 encoded.
Additionally, in MATLAB R2020a or later, 'fileread' function detects the encoding automatically.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 JSON Format에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!