in reply to Re^9: Key bindings in the Debugger
in thread Key bindings in the Debugger

I am not 100% convinced that it's really Strawberry's job. Whenever you are working with text input and output, whether through a standard file interface or through a CLI/console, you are responsible for knowing what your file encoding or console encoding/locale is. Modern Linux helps you out with LANG or LC_ALL usually defaulting to a useful UTF-8-based locale, but it's still up to someone in a Linux environment to know what that setting is on their system; similarly, someone on a Windows system using Strawberry Perl should know (or be willing to research how to know) what codepage settings are relevant. Trying to use a character that's not available in the current encoding will always cause problems, Strawberry or not.

However, maybe it would be nice if the debugger on Strawberry (or any Windows perl build) would at least tell you the Win32::GetConsoleCP and Win32::GetConsoleOutputCP values (much like it warns you that it cannot figure out the console) -- I don't think Strawberry customizes perl5db.pl , so I believe that means that it would have to be changed in the main perl source code.

In order to make sure I'm always in UTF-8 mode, I set up the Autorun registry entry for cmd.exe years ago. This conversation prompted me to research, and I have confirmed that I can use the $PROFILE file for powershell to do something similar:

With those, then when I launch the debugger from either command-line, the codepages are set to 65001 (UTF-8) for both input and output.

Replies are listed 'Best First'.
Re^11: Key bindings in the Debugger
by LanX (Saint) on May 26, 2025 at 14:56 UTC
    Thanks!

    > I am not 100% convinced that it's really Strawberry's job.

    Neither am I that's why I ask/meditate. (Too many dragons in exaggerated DWIM)

    But Strawberry wouldn't need to patch perl5db.pl, the debugger has config files and so does Perl itself.

    AFAIK did Strawberry and ActivePerl always "localize" the installation to Win.

    Anyhow I think it would be best placed in Term::ReadLine and/or the included backends, the debugger is not the only app relying on ReadLine.

    The simplest approach would be for ReadLine to check if Win32:: is loaded and to warn if control character area is mis-used. The same way setting "Term=dumb" is recommended.

    FWIW I see that ReadLine is capable to return IN / OUT filehandles and I remember it's possible to provide the codepage in the encoding.

    So probably (?) it could be possible that ReadLine adjust itself automatically to the current CP.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery