Add unit tests for encoding aware