Fix exception when printing unicode characters