in reply to Re: LWP::ConsoleLogger::Easy messes the console on (seemingly) unicode LWP response: is it a case of broken unicode?
in thread LWP::ConsoleLogger::Easy messes the console on (seemingly) unicode LWP response: is it a case of broken unicode?

For example, you set a 'Content-Type' request header. This is NOT a valid header.

I was throwing at it all I could find

JSON::XS did not have any problem decode_json'ing that JSON. And if I don't import and use the Logger print $response->decoded_content; works just fine (without binmode'ing STDOUT). Additionally, sometimes it fails (=messing the console) while printing Content and sometimes when it prints Text (which I believe is printing decoded JSON)

I will follow what Corion said and report it. Though I hate dumping encoding bugs on unsuspected passerbys.

thanks!

  • Comment on Re^2: LWP::ConsoleLogger::Easy messes the console on (seemingly) unicode LWP response: is it a case of broken unicode?
  • Select or Download Code

Replies are listed 'Best First'.
Re^3: LWP::ConsoleLogger::Easy messes the console on (seemingly) unicode LWP response: is it a case of broken unicode?
by cavac (Prior) on Aug 25, 2023 at 06:45 UTC

    Though I hate dumping encoding bugs on unsuspected passerbys.

    Wish i had the same luxury. It feels like i'm spending half my life fixing encoding bugs these days. Unicode is great... when it works. Just last month i spend half an afternoon trying to fix a printing bug, until i realized that font i was using had a bug...

    But look at it this way: Humans have lots of different cultures and writing systems. The more Unicode bugs we fix, the more inclusive our programs become. In the long term, tearing down the walls that divide cultures will (hopefully) bring people closer together and reduce the prevalence of bigotry and wars.

    PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
Re^3: LWP::ConsoleLogger::Easy messes the console on (seemingly) unicode LWP response: is it a case of broken unicode?
by NERDVANA (Priest) on Aug 25, 2023 at 21:12 UTC
    I could be wrong, but I think the only thing that would corrupt a terminal would be control codes, and specifically the escape character \e. Any utility meant to dump protocol traffic to a terminal should always escape the control codes. Before reporting it, see if you can find the line that does the printing, and add this:
    $str =~ /([\0-\x09\x0B\x1F])/sprintf("\\x%02X", ord $1)/ge;
    and see if it stops corrupting your terminal. Then you could submit a pull request instead of a bug report :-)