grit icon indicating copy to clipboard operation
grit copied to clipboard

Double backslashes when comes to ascii incompatible string.

Open simsicon opened this issue 11 years ago • 0 comments

Hi guys, when Grit tries to get diffs, and name of files in diffs contains ascii incompatible string like CJK, it would give some unexpected string, like what I did in this test .

Basically a_path/b_path will looks like "\\344\\270\\255\\346\\226\\207.txt", rather than "\344\270\255\346\226\207.txt", single backslash is convertible, double backslashes is not, Ruby consider double backslashes as escaped.

I am thinking of

$SAFE = 4
eval %Q{"#{a_path}"}

like code with safe protecting to eval this string, but I don't think it's the best solution, I don't even think this is a way of solving double backslashes, do you guys have any good ideas? Please check the test to reproduce this problem. Thanks.

simsicon avatar Dec 11 '13 06:12 simsicon