java - .listFiles() returned file object returns false on .exists() - file contains special character(s) -


i've got java application zipping given directory. file omitted containing special character (e.g. umlaut - ä, ö, etc.). debugging showed, file omitted because not exist

if(file.exists()) {   //zip } else {   system.err.println("file " + file.getabsolutepath() + " not exist!"); } 

the thing - retrieve file object from

file[] files = directory.listfiles(); 

and iterrate through them.

for(file file : files) {   if(file.exists()) {     //zip file   } else {     system.err.println("...");   } } 

what saw is, file.getabsolutepath() shows me following path /tmp/myspecialchar?file.txt instead of /tmp/myspecialcharÖfile.txt.

any ideas how hold of file. unfortunately special characters translated "?" cannot implement mapping. listing names returns "?" instead of correct special character.

before forget - jvm version 1.6.31.

you need set file.encoding system property of jvm

-dfile.encoding=utf-8 

please, note has done @ start-up java parameter. doing later system.setproperty() won't value (that comes host os) cached then.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -