Makes sure encoding is done with same string encoding.