Closed WindLi001 closed 1 year ago
Hi @WindLi001
First of all, thanks for the issue and the PR !
As you told, setting by default a specific charset might introduce side effects on go-exiftool
clients and I don't want to risk that.
I had already introduced an option to specify a charset when initializing go-exiftool
: Charset
.
You should initialize go-exiftool
that way:
e, err := NewExiftool(Charset("filename=utf8"))
I'll close the issue but re-open if if my hint does not fix your problem.
Thank you for your reply. I should read the document before raising this issue.
I change my code to
et, err := exiftool.NewExiftool(exiftool.Charset("filename=utf8"))
fileInfos := et.ExtractMetadata("D:\\测试数据\\IMG_20220102_202220.jpg")
, and it's worked.
I try to use go-exiftool to get exif from the JPEG file in Windows environment.
When I call ExtractMetadata(), if the parameter files includes non-ASCII character, for example,
fileInfos := et.ExtractMetadata("D:\\测试数据\\IMG_20220102_202220.jpg")
the calling is failed, with the error message likeBut if the parameter files includes only ASCII character, for example,
fileInfos := et.ExtractMetadata("D:\\test-data\\IMG_20220102_202220.jpg")
everything is OK.And I found this page [https://exiftool.org/exiftool_pod.html#WINDOWS-UNICODE-FILE-NAMES] in exiftool documentation. So, I think maybe go-exiftool should add the option -charset filename=utf8 to solve the problem.
I try to change the code of go-exiftool. In detail, I change
var initArgs = []string{"-stay_open", "True", "-@", "-"}
tovar initArgs = []string{"-charset", "filename=utf8", "-stay_open", "True", "-@", "-"}
And it's really worked in Windows. But I'm not sure if it has side effect in other OS. I'll create a pull request soon.