Revert "Revert "Unicode compatibility improvements""

This reverts commit 1d5a4dd1b78c74b94476784d4ed9e126bf898f2c.