Merge pull request #1 from georgeye/master

fix encoding issue
add more rules for encoding