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!