It seems there is a problem specifying non-ascii characters in filenames to fopen. Do I need to encode these somehow?
Any help appreciated, dave r.
OSX10.6, English language, Swedish Region
>> feature('DefaultCharacterSet')
ans =
ISO-8859-1
>> getenv('LANG')
ans =
sv_SE.ISO8859-1
Now, suppose I have a file called 'öäå.txt' (which, if we have problems with encoding, are ISO 8859-1 characters 246,228,229 followed by .txt). In Matlab:
I want to open the file:
id = fopen('öäå.txt','r','n','UTF-8') id =
-1
As a workaround for a single file, I can use: >> D = dir('*.txt')
D =
name: 'oÌaÌaÌ.txt' date: '17-Jun-2011 16:02:36' bytes: 987 isdir: 0 datenum: 7.3467e+05
>> id = fopen(D.name,'r','n','UTF-8')
id =
3
but I would like a solution where I can actually specify the filename directly!
Best Answer