catch miss-encoding exception while using Popen and fix the encoding