Skip to content

Commit db4e3ca

Browse files
author
fangq
committed
reading unicode encoded json files, thanks to Sertan Senturk
git-svn-id: http://svn.code.sf.net/p/iso2mesh/code/trunk/jsonlab@482 786e58fb-9377-0410-9ff7-e4ac0ac0635c
1 parent 70a8ed1 commit db4e3ca

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

loadjson.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@
6666
if(regexp(fname,'[\{\}\]\[]','once'))
6767
string=fname;
6868
elseif(exist(fname,'file'))
69-
fid = fopen(fname,'rb');
70-
string = fread(fid,inf,'uint8=>char')';
71-
fclose(fid);
69+
try
70+
string = fileread(fname);
71+
catch
72+
string = urlread(['file:///',fullfile(pwd,fname)]);
73+
end
7274
else
7375
error('input file does not exist');
7476
end

0 commit comments

Comments
 (0)