petdance/scratch — Issue #79: Parrot assumes command line arguments are ASCII
Author: petdance
Created: 2011-11-01 04:24:47+00:00
State: open

Currently Parrot (incorrectly) assumes that all command line arguments are ASCII:

{{{
$ cat x.pir
.sub 'main'
.param pmc args

$S0 = args[1]
say $S0

$I1 = charset $S0
$S1 = charsetname $I1
say $S1

$I1 = encoding $S0
$S1 = encodingname $I1
say $S1

$I1 = length $S0
say $I1
.end
$ ./parrot x.pir 'say «hello»'
say «hello»
ascii
fixed_8
13
$
}}}

Most would expect the above to be a unicode/utf8 string of length 11.

If Parrot itself cannot be easily changed to accept unicode/utf8 command line arguments, then it would be nice to have a way to easily convert the "ascii" strings in args into proper unicode strings. Thus far I've been unable to find a good way of doing that.

This ticket also relates to Rakudo RT #66364.

Pm