in reply to Windows %ENV and utf8

Hello gweekly,

[Cross-reference: LibXML and %ENV in 5.18 on Windows.]

Received in a /msg:

Should I do anything more in hopes of getting someone to look deeper into debugging this (eg: how to contact the code author, or submit a bug report?)?

If the line my $utf8 = Encode::decode('utf8', 'SAM'); is replaced with my $utf8 = 'SAM';, then the problem goes away. So, at first sight it would appear that the bug is in the Encode module. However, on closer inspection it becomes clear that the problem derives from the way Perl itself handles the built-in %ENV hash.1 So my best advice is to submit a bug report re Perl itself. Follow the directions in perlbug and include a reference to this PerlMonks thread: http://perlmonks.pair.com/index.pl?node_id=1180341.

Hope that helps,


1Of possible relevance is the “Defined values stored in environment are forced to byte strings” note in perl5180delta:

A value stored in an environment variable has always been stringified when inherited by child processes.

In this release, when assigning to %ENV, values are immediately stringified, and converted to be only a byte string.

However, this mentions %ENV values only, whereas the bug pertains to utf8-encoded keys.

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: Windows %ENV and utf8 -- don't do it
by Discipulus (Canon) on Jan 31, 2017 at 11:50 UTC
    If I can add something i remeber tye explaining me that on windows %ENV keys are case retentive: this was made because on such OS ENV is implemented in this way so %ENV reflect the behaviour.

    Consider the following two examples:

    set foo=bar & set FOO=BAR & set FOO foo=BAR set FOO=BAR & set FOO=bar & set FOO foo=bar

    So for sure also %ENV keys (not just values) must be treated as special, very funny and tricky, strings. In short: do not do it! keep %ENV keys uppercase ASCII plain strings and values as close as possile to a plain ASCII string

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re^2: Windows %ENV and utf8
by gweekly (Novice) on Jan 31, 2017 at 20:14 UTC
    Thank you. Submitted https://rt.perl.org/Ticket/Display.html?id=130683