view audio/private/jfile.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 62e31e7980e6
children
line wrap: on
line source
% jfile - construct Java File object from path string
% jfile :: text -> java.io.File.
function f=jfile(path)
	% The problem was that file names with accents in where not being found 
	% when converted to Java file names.
	% I have no idea what is going on here but it seems to work
	% f=java.io.File(java.lang.String(unicode2native(path,'latin1'),'UTF8'));

	% SA 2014: UPDATE
	% Now I have a faint idea about what is going on here. Matlab ignores the
	% LANG environment variable, and previously was using LATIN1 as it's
	% feature('DefaultCharacterSet'). This meant that the entire Java subsystem
	% was starting up with LATIN1 as its chacterset. Now, I have found a way
	% to persuade Matlab to use Unicode, and indeed, for the JVM to use unicode
	% also. This means that the old version of this function was no good.
	% Instead, we should use unicode2native with no 2nd argument.
	f=java.io.File(java.lang.String(unicode2native(path),'UTF8'));