Fix shell unicode error when current directory name is not ASCII

Ref #1197.