Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when trying to read a directory with Japanese filenames #447

Open
PseudoDistant opened this issue Apr 8, 2022 · 9 comments
Open

Comments

@PseudoDistant
Copy link

Exception in thread "Basic L&F File Loading Thread" java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: /home/distant/????????????????????????
at java.base/sun.nio.fs.UnixPath.encode(UnixPath.java:121)
at java.base/sun.nio.fs.UnixPath.(UnixPath.java:68)
at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:279)
at java.base/java.nio.file.Path.of(Path.java:147)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at java.desktop/sun.awt.shell.ShellFolder.getShellFolder(ShellFolder.java:265)
at java.desktop/javax.swing.filechooser.FileSystemView.getFiles(FileSystemView.java:585)
at java.desktop/javax.swing.plaf.basic.BasicDirectoryModel$FilesLoader.run0(BasicDirectoryModel.java:306)
at java.desktop/javax.swing.plaf.basic.BasicDirectoryModel$FilesLoader.run(BasicDirectoryModel.java:295)
at java.base/java.lang.Thread.run(Thread.java:833)

I had a Tiny file in my home, but it refused to read the folder and spammed this in console until I moved the non-Latin files.

@liach
Copy link
Contributor

liach commented Apr 8, 2022

Hmm, I typed some random Japanese through google translate for directory name, and I can load it with enigma. I am on windows and java 17. Unfortunately I don't have a linux environment to test. java 18 has a utf-8 by default feature (jep 400); can you try with java 18?

Also make sure your directory names are in some compatible encoding. I know some non-english file names can have their names messed up, such as after extraction from zip or rar files.

@PseudoDistant
Copy link
Author

@liach I have the same problem on Java 18, and the file names are in Katakana.
However I've been able to confirm that it also fails with Chinese and Korean filenames as well.

@2xsaiko
Copy link
Collaborator

2xsaiko commented Apr 8, 2022

Might be a system locale issue, I've encountered problems with non-ascii file names when the locale was set up incorrectly (e.g. using a non-UTF8 locale or a locale that doesn't exist on the system because it wasn't generated or something like that), though I don't know if Java uses libc locale at all in any way. What's the output of running locale in a terminal?

@PseudoDistant
Copy link
Author

Might be a system locale issue, I've encountered problems with non-ascii file names when the locale was set up incorrectly (e.g. using a non-UTF8 locale or a locale that doesn't exist on the system because it wasn't generated or something like that), though I don't know if Java uses libc locale at all in any way. What's the output of running locale in a terminal?
locale -a

@2xsaiko
Copy link
Collaborator

2xsaiko commented Apr 8, 2022

Yeah those "No such file or directory" messages do seem like that is the problem. Could you also send the output of locale?

@PseudoDistant
Copy link
Author

Yeah those "No such file or directory" messages do seem like that is the problem. Could you also send the output of locale?
locale

@2xsaiko
Copy link
Collaborator

2xsaiko commented Apr 9, 2022

These should say "ja_JP.UTF-8" instead of "ja_JP". Change it wherever you set that up initially (don't forget to log out and back in to reload the environment). That should fix it.

@PseudoDistant
Copy link
Author

These should say "ja_JP.UTF-8" instead of "ja_JP". Change it wherever you set that up initially (don't forget to log out and back in to reload the environment). That should fix it.

I set these via Plasma System Settings, I actually don't know how to change it manually.

@2xsaiko
Copy link
Collaborator

2xsaiko commented Apr 18, 2022

Interesting, that's probably a Plasma bug then, probably worth reporting (though for me it shows them all as having a UTF-8 suffix... not sure what's different between our installations).

Either change those back to the defaults (Reset button on the bottom panel in System Settings/Formats) and then depending on your distro, configure the system locale (see distro documentation for that, since it's specific to each one).

Otherwise, you could try setting the correct locale names in ~/.config/plasma-localerc (I assume there they don't have the UTF-8 suffix either), but I'm not sure if that will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants