change and restore encoding system to avoid encoding convert problem

as git will always return as utf-8 encoded, set system encoding to utf-8 and then restore to avoid encoding convert(which do not work correctly in NON english)