Fix double- and zero-wide characters

It's not perfect but seems to work well enough.