Add unit tests for encoding aware 

Just add unit tests for pull request #20 already merged