I want to restore a specific file but either the path or filename contains a unicode character.
“Windows Command Prompt” is set to “chcp 65001”, so the characters are displayed correctly.
I don’t have any problem with paths and filenames containing unicode characters in batch scripts etc.
Example “Windows Command Prompt”
>restic -q -r test init
>restic -q -r test backup files
>restic -q -r test ls latest
/files
/files/あ.jpg
These commands don’t work:
restic -r test find あ
restic -r test restore latest --target . --include /files/あ.jpg
Full restore works: restic -r test restore latest --target .
I guess restic -r test restore latest --target . --include /files/*.jpg would work as well`
That said, can you not use UTF-8 in your terminal instead? I’m not sure if that would help but unless I’m misunderstanding you, you’re using a different code page.
chcp 65001 sets Encoding to UTF8. As I’ve said, all my console programs or scripts have been working fine with unicode characters, that’s why I feel like it might be an issue with restic?
--include /files/*.jpg
That could be a workaround, but I’m intending to use this command a lot and it might not always be precise enough.
I see, I thought 65001 was a different code page. Why on earth would one have to enter “65001” out of all possible combination of characters, instead of just “UTF-8”? Thats insane!
I agree the workaround isn’t precise and that this should be investigated further. I guess you already tried to copy the Unicode character from the ls into the restore command, and that this doesn’t make it match?
Sorry, it seems I was just stupid. This command DOES work: restic -r test restore latest --target . --include /files/あ.jpg
I didn’t notice because (obviously) it restores to the same folder/file that’s already present in that directory…
And the reason I made this test repository is because I was trying to figure out why a file wouldn’t restore from my remote repository. I now figured that out as well. I somehow used this - instead of this — character…
The find command also seems to work:
restic -q -r test find あ.jpg
/files/あ.jpg
However, this doesn’t. Maybe that’s normal? restic -q -r test find あ
Anyways, I’m happy it wasn’t an issue with restic and thanks for your time!
Nice! Yeah if you’re supposed to use a regular dash for the options/flags then thats what to use and one shouldn’t expect other types of dashes to work. Glad it all works now!