Incorrect Emoji while using "fileread" from json file
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 10 Nov 2020
Réponse apportée : MathWorks Support Team
le 1 Fév 2021
Why am I getting incorrect Emoji while using "fileread" from JSON file?
I am using MATLAB R2019a version.
Réponse acceptée
MathWorks Support Team
le 10 Nov 2020
'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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur JSON Format dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!