zwrite: Assume UTF-8 rather than ISO-8859-1 in an ASCII locale #132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It turns out that lots of scripts still run
zwrite
without setting any locale environment variables. The charset of the default C locale is ANSI_X3.4-1968 (ASCII), so we were sendingz_charset = ZCHARSET_ISO_8859_1
. But UTF-8 is much more common these days, so this results in a lot of mislabeled zephyrs.Other clients just ignore
z_charset
(Roost made a good-faith effort to respect it, and gave up after finding that it really has no correlation with the actual charset); but it still caused incorrect display inzwgc
.Since UTF-8 is just as good a superset of ASCII as ISO-8859-1 is, we should just assume UTF-8 by default in this case.
(We still assume ISO-8859-1 if the locale explicitly specifies that, such as
en_US
. Almost nobody uses such locales anymore.)