If you have better method I would be interested to know, this was my workaround.
Need to backup/restore/find files with Korean and Chinese characters while in an English environment.
Windows CMD and PowerShell seem to be incapable of producing Korean and Chinese characters, they produce a nondescript symbol as a substitute. Found the command chcp 65001 to change unicode to UTF-8 was ineffective. Same with chcp 1200 (UTF-16).
Found a couple of PowerShell terminal utilities that would display files in their original languages, they had the same issue of not being able to run as admin (underlying libraries cannot run as admin). Both Windows Terminal and Fluent Terminal seemed to work as advertised, there are probably others like these that work just as well.
Best to run Terminal Server as administrator (when pinned to the task bar admin option not available)
Fluent Terminal can’t run as administrator using RunAs opened a native CMD or Powershell window and you have the same problem of working with rubbish symbols. Sudo from the creator of scoop, Luke Sampson, solved that problem. Terminal Server is able run as administrator but not pinned to task bar.
Now restic can display and work with files backed up with names in Hangul and Chinese characters.
What didn’t work:
In my test file there was as a ’ character in the file name that killed any attempt of a restore. The file name had to be truncated to avoid that character. That occurred in both the original file name and English equivalent. Not sure if a PowerShell or restic (golang) parsing problem.
Based on http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx
a single quote is allowed but the star character is not allowed in a file name. I am completely ignorant of how non-ascii file names.
Correct “*” is not a permitted character for a file name.
When you enter a file name into restic and many other applications you don’t have to enter the file name (and path) as required by Microsoft. Alternatives are:
- Some applications convert it to a Linix/Unix like path where
F:\this\that\here\some_file becomes /F/this/that/here/some_file
it all depends upon the application whether it is case sensitive or not.
- You can use special characters like “*” and others to help you by making searching for file and other objects a lot simpler, it saves a lot of typing. This technique is known as Regular Expressions or regex and its very common in command interfaces and programming languages. There is no guarantee of uniformity in regular expression special characters but they mostly operate the same every where.
When you enter a file or path name into restic you are telling it to search for the objects based on the search criteria which may or may not contain regular expressions. The results of the search will be listed or recovered depending on you instructions.
These seems to be a reasonable introduction to regular expressions.
This is not right. The
* in this context has nothing to do with regular expressions - regular expressions is another thing and not related here.
* in this context is more commonly referred to as a “wildcard character”, and as Wikipedia also says “The operation of matching of wildcard patterns to multiple file or path names is referred to as globbing”.
Regular expressions is one of the best things in the world if you ask me, but it’s not what we’re talking about here
Sidenote: In regular expressions the
* would mean “zero or more occurrences of” and would not be usable on its own, it needs to refer to something that comes before it.
Duh…I should have tested more.
Went through the doco probably needs to be explicit in which pattern matching type its using, referencing the Go function filepath.Glob implies globbing by its name and not much else. But good to get it correctly sorted.
I don’t understand what you’re saying here. I run Windows Terminal as admin all the time, and using restic in it shows CJK characters correctly without hassle.
Thanks - corrected my notes and confirmation of CKJ chars I did some basic testing all seemed good. Windows extended characters on the command line is something I normally wouldn’t worry until I struck this little puzzle.