Fix non ascii parse error issue in diff, and some old fix from github/grit

If there is non-ascii chars in the filename, diff parse failed.
Especially when it is the first commit of the repo, I improved the regexps but wonder whether it is the best solution.