You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Values from command-line switch -s are not in UTF-8 #23377
changed the title [-]Values from command-line switch `-s` is not in UTF-8[/-][+]Values from command-line switch `-s` are not in UTF-8[/+]on Jun 19, 2025
-s is discouraged in the docs and is extremely rudimentary. This could be considered a bug since -CA should interpret @ARGV in the internal upgraded encoding, but apparently that doesn't apply before -s. I would recommend using Getopt::Long instead, or an option parser that may be more oneliner friendly like https://metacpan.org/pod/Opt::Imistic.
Activity
[-]Values from command-line switch `-s` is not in UTF-8[/-][+]Values from command-line switch `-s` are not in UTF-8[/+]guest20 commentedon Jun 19, 2025
-s, wow. It's been a hot minute...Grinnz commentedon Jun 19, 2025
-s is discouraged in the docs and is extremely rudimentary. This could be considered a bug since -CA should interpret
@ARGVin the internal upgraded encoding, but apparently that doesn't apply before-s. I would recommend using Getopt::Long instead, or an option parser that may be more oneliner friendly like https://metacpan.org/pod/Opt::Imistic.I also recommend https://metacpan.org/pod/Decode::ARGV instead of -CA and https://perldoc.perl.org/open or https://metacpan.org/pod/open::layers instead of -CSD in any serious code, because -C does not validate that the input is UTF-8 nor does it restrict its output to UTF-8, but instead assumes everything is in Perl's internal upgraded encoding which is a superset of UTF-8.
agguser commentedon Jun 19, 2025
I think
-sis good enough for one-liner code (likeawk -v), so please fix it to be consistent with@ARGV.To ensure backward compatibility,
smay be added to be a value for-C(e.g.-CsASD).Also, it would be great to have a hash variable (specified by
-s:) containing all-svariables, e.g.:mark -s switches as UTF-8 with -CA
mark -s switches as UTF-8 with -CA