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

It's a tragedy that the go-unarr package does not support directory paths in Chinese #7

Closed
ji1126 opened this issue Aug 28, 2019 · 4 comments

Comments

@ji1126
Copy link

ji1126 commented Aug 28, 2019

Absolute paths have been used, but as long as directory paths or file names contain Chinese, they always exit incorrectly.

unarr: File not found

`var 当前目录, _ = os.Getwd() //获取当前目录 C:\

var 压缩文件路径 = filepath.Join(当前目录, "vrt.7z") //合成 文件 文件路径
log.Println("压缩文件路径 ", 压缩文件路径)
//  打开存档
压缩文件缓存, err := unarr.NewArchive(压缩文件路径)
if err != nil {
	log.Fatal("打开 压缩文件存档 错误 ", err)
}
defer 压缩文件缓存.Close()`
@gen2brain
Copy link
Owner

You can use NewArchiveFromMemory or NewArchiveFromReader, and just open file with standard Go functions.

@gen2brain
Copy link
Owner

That will, of course, load the whole file to memory, but to really fix this error bundled C unarr lib must be fixed. I am not the one who can fix that. unarr from sumatrapdf now has new home here https://github.com/selmf/unarr , maybe you can ask for help there.

@selmf
Copy link

selmf commented Jun 13, 2022

@gen2brain This is a common Windows problem. The standard fopen() on Windows does not accept Unicode strings, so opening non-ASCII files will not work. For these cases, Unarr offers the ar_open_file_w function which accepts UTF-16 paths, which should support Chinese characters.

@gen2brain
Copy link
Owner

I was not aware that this issue is Windows only, thanks @selmf. This should be fixed in 102d9fb

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