Escaping Chinese characters (and spaces) with scp

28 Oct 2012

It took me a bit longer than perhaps it should have to work this out.

scp -r user@host:'"~/build/江南大学 ESK03/"' local_path/

First I tried the usual \ backslash shell escaping, then tried putting double-quotes around the entire user@host:filename string. Then after reading the scp manpage (which didn’t help) and googling (which wasn’t much better) I tried double-escaping the filepath and that works.

I won’t pretend to understand exactly why single-escaping didn’t work (it seems to have worked for others) but I will hazard a guess that it’s something to do with the way the remote system handles the path (CentOS 6.3 in this case).

Other notes

2016

2014

2013

2012

2011

2010