AnyEvent::Log UTF8 strings to terminal?
Mark Lawrence
mark at rekudos.net
Mon May 5 22:03:51 CEST 2025
On Mon May 05, 2025 at 08:08:06AM -0400, Felipe Gasper wrote:
>FWIW I maintain that that pragma causes more trouble than it solves.
>Here’s a presentation I did that touches on this:
>https://www.youtube.com/watch?v=yH5IyYyvWHU&pp=ygUSZmVsaXBlIGdhc3BlciBwZXJs
Thanks for the informative presentation. I learned a lot, but not quite
enough it seems :-(
>Omitting `use utf8` is one way to solve your problem.
Even with the video, I don't think your suggestion has quite enough
context for me to understand how it helps.
Isn't the standard philosophy, that as a Perl User I should deal in
(unicode) codepoints? And that I encode to/from UTF-8 at the boundaries?
So by default I set filehandle encoding to UTF-8. If I now define UTF-8
strings under "no utf8" I get mojibake:
no utf8;
binmode STDOUT, ':encoding(UTF-8)';
say '│⣿'; # â⣿
So of course "use utf8" solves this problem under this philosophy.
Unless, as in the AE::log case, there is a filehandle outside my
control, which doesn't encode.
Your "no utf8" suggestion feels like the opposite. Are you saying use
UTF-8 strings everywhere and do not encode filehandles? Or are you
saying I need to keep track UTF-8 strings decode them just before
output? Then lots of other things break...
What am I missing here? :-)
--
Mark Lawrence
More information about the anyevent
mailing list