encoding fix (cherry picked from commit 2c194ff)