Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: Encoding problem with function in C library

by syphilis (Archbishop)
on Dec 23, 2022 at 00:09 UTC ( [id://11149039]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Encoding problem with function in C library
in thread Encoding problem with function in C library

use warnings; use strict; use open qw/:std :encoding(UTF-8)/; use Win32; Win32::SetConsoleOutputCP(65001); print "\N{U+B1}\N{U+221E}\n";
That works nicely on Windows 10 and 11. But not on Windows 7, where I find that altering the codepage ostensibly succeeds, but in reality takes no effect.
Perhaps the explanation for that might be found in one of AM's links.
Anyway, I can probably ignore this issue with Windows 7 and earlier. It's unlikely that anyone other than me would ever hit it.

... so unless you've got some other funky Unicode stuff going on, I don't think you'd need to change it back

Yes, I think so. It seems that Win32::SetConsoleOutputCP(65001) sets the codepage for the duration of the program and that should generally be fine, whereas chcp 65001 sets it for the duration of the cmd.exe console (and that's not so acceptable).

Thanks again for the pointers, guys !!

Cheers,
Rob

Replies are listed 'Best First'.
Re^5: Encoding problem with function in C library
by haukex (Archbishop) on Dec 23, 2022 at 08:40 UTC
    It seems that Win32::SetConsoleOutputCP(65001) sets the codepage for the duration of the program

    As Corion pointed out, that's unfortunately not the case, the change does persist and you'll have to do something in an END block like he showed.

      As Corion pointed out, that's unfortunately not the case, the change does persist and you'll have to do something in an END block like he showed.

      Oh ... ok, I'll deal with that. Thanks for the heads up.

      Cheers,
      Rob
Re^5: Encoding problem with function in C library
by hippo (Bishop) on Dec 23, 2022 at 08:16 UTC
    Anyway, I can probably ignore this issue with Windows 7 and earlier

    7 is already long past standard EoL and goes full EoL on the 10th of January (ie, less than 3 weeks from now) so yes it should definitely just be ignored.


    🦛

      7 is already long past standard EoL and goes full EoL on the 10th of January

      Like many of those who experienced Windows Vista, I still have a lot of love for Windows 7 ... for the simple reason that it wasn't Windows Vista ;-)

      Cheers,
      Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11149039]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-20 00:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found