Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum wrote:
Be that as it may, an output with an undeterministic character encoding isn't really what you want even when debugging.
Frankly, it seems to me that werror() ought to encode the message using the environment character encoding, and escape any unencodable character as \uxxxx or suchlike. But until that happens, may I suggest printing with %q instead?
Technically, you're right, and for now the safe option would be to use something like %q instead. However, considering the fact that most display devices/environments are moving towards UTF-8 as the (defacto) default these days, having it in UTF-8 directly allows for more practical/usable debugging output. And even if your particular terminal doesn't support UTF-8 but does something else, then there are standard converters which convert from UTF-8 to whichever you are using now; but you'd be hard-pressed to find a (standard) converter from the ouput %q generates to whichever encoding your terminal is using.