grit
grit copied to clipboard
Double backslashes when comes to ascii incompatible string.
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.