I'm using FileUtils.moveFileToDirectory on a file with special characters in its name, for exemple : ╩╦╠═╬╧╨╤... and other kind of alt code characters. I can see these characters on the file name on the server before moving the file, but once the function is called, the moved file in the destination directory replaces these specials characters with �. Is there a way to keep the specials characters when I move this file please ?
Asked
Active
Viewed 513 times
3
-
Is it really necessary for such exotic filenames? You are begging for problems. – Pieter De Bie Apr 17 '15 at 09:02
-
I know, but I have to make it work even with such characters – NeS Apr 17 '15 at 09:05
-
Have you looked into *html entity encoding* ? – Praxis Ashelin Apr 17 '15 at 09:16
-
yes but there isn't any parameters for encoding. FileUtils.moveFileToDirectory(sourceFile, destinationDirectory, createDirectoryIfNeeded); – NeS Apr 17 '15 at 09:28
-
Whoever gave you this task does not like you very much... On what FileSystem is this intended to work? – Fildor Apr 17 '15 at 10:23
-
I wonder, can you read / check existence of a file which is named "╩╦╠═╬╧╨╤"? – Pieter De Bie Apr 17 '15 at 11:15
-
Have you tried this: http://javarevisited.blogspot.be/2012/01/get-set-default-character-encoding.html ? – Pieter De Bie Apr 17 '15 at 11:36
-
I've checked the blog about encoding, and it didn't helped. I'm already using UTF-8. About the FileSystem I don't know what this server is using, but it's possible to have files with these characters on the server, it's only the moveFile that doesn't work – NeS Apr 17 '15 at 13:59