• MicrosoftDefault: a codec to adapt Python to the Win11 Terminal

    From moi@21:1/5 to All on Tue Nov 8 00:47:31 2022
    MicrosoftDefault: a codec to adapt Python to the Win11 Terminal

    Not really a "codec", but the spirit is here.

    PS C:\humour>
    PS C:\humour> get-content ms52.txt
    abc霟
    PS C:\humour> py38 get-text-file.py ms52.txt
    abc霟
    PS C:\humour> get-content ms52.txt -encoding default
    abc霟
    PS C:\humour> py38 get-text-file.py ms52.txt -encoding MicrosoftDefault
    abc霟
    PS C:\humour>

    PS C:\humour> # so far, so good
    PS C:\humour> # let’s store the content...
    PS C:\humour>
    PS C:\humour> $a = get-content ms52.txt
    PS C:\humour> # $b = py38 get-text-file.py ... will not work properly
    PS C:\humour> # new test file
    PS C:\humour>

    PS C:\humour> $a = get-content ms52-a.txt -encoding default
    PS C:\humour> $b = py38 get-text-file.py ms52-a.txt -encoding MicrosoftDefault PS C:\humour> $a -eq $b
    True
    PS C:\humour>
    PS C:\humour> # good, except a small annoying problem
    PS C:\humour> $correct = get-content52 ms52-a.txt
    PS C:\humour> $a -eq $b
    True
    PS C:\humour> $a -eq $correct
    False
    PS C:\humour> $b -eq $correct
    False
    PS C:\humour>

    Software can be really funny...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)