hierynomus / smbj

Server Message Block (SMB2, SMB3) implementation in Java
Other
707 stars 180 forks source link

diskShare.list() → fileNames are missing non ASCII chars #761

Closed colenio-mhe closed 1 year ago

colenio-mhe commented 1 year ago

Hello together,

I'm facing a problem with our beloved "umlauts".

I use the diskShare.list() function to list all files of a dictionary in a share, after that I iterate through all of them, already here, the FileIdBothDirectoryInformation.fileName is missing the äüö characters.

Can someone give me a hint what I'm missing?

Example code (Kotlin):

diskShare.list(directoryPath) .filter { fileInfo -> if (fileInfo.fileName in listOf(".", "..") return@filter false val path = Paths.get(directoryPath, fileInfo.fileName).toString() //fileInfo.fileName already missing öäü return@filter diskShare.fileExists(path) }.mapNotNull { //some rules... } .toList()

Everything works as expected until we get a file with these "special" characters into the directory.

Thanks for any hints!

colenio-mhe commented 1 year ago

Hello everyone,

I was able to figure out what the problem was. Actually, the docker image we used had the file.encoding set to ANSI_X3.4-1968… Therefore, äöü couldn't be decoded correctly!

hierynomus commented 1 year ago

@colenio-mhe Just to check, the Docker image running the client or the server?

colenio-mhe commented 1 year ago

@colenio-mhe Just to check, the Docker image running the client or the server?

The Image running the client. Due to the (default) file.encoding set for the JVM, öäü were lost.