encoding problem fixed.

Here are the fix and unit test.