develooper Front page | perl.perl5.porters | Postings from January 2001

Re: 8482 busted for $^V sprintf()s on OS/390

Thread Previous | Thread Next
January 21, 2001 12:28
Re: 8482 busted for $^V sprintf()s on OS/390
Message ID:
Andreas J . Koenig <> writes:
>>>>>> On Sun, 21 Jan 2001 11:35:08 +0000, (Nick Ing-Simmons) said:
>  > At least _this_linux box's konsoles are NOT UTF-8 aware.
>  > As I understand it by default perl is still iso8859-1 (ASCII world)
>Yes, you're right, I forgot that. Please let me ask a few more
>questions, maybe these are FAQs in the near future...
>1) What do we offer as convenience for the XFree users that have
>   switched to UTF-8 terminals?

foreach my $handle (\*STDIN,\*STDOUT,\*STDERR)
  binmode($handle,":utf8") if -t $handle;

(Presumably they want the "default encoding" to be UTF-8 if the handle 
is a tty. And if someone telnets/rlogin etc. to such a machine from 
Solaris, HPUX etc. they get what they deserve.)

If you can spell out how I do that (I am running XFree86 4.02), you 
can expect more progress. (Does such a terminal advertise its status
in %ENV ? - is there one with real scrollbars yet?) 

It is still not clear that UTF-8 should be the defauilt on all handles 
even on such a beast. HTTP sockets should still be iso8859-1 I assume. 

>2) Where is or should that be documented?

As there isn't really anything offered (yet) it isn't documented.

>3) How does a user find out about available disciplines on his
>   installation?

You can find out which disciples are available at any instant with 
this sort of thing:

nick@dromedary 539$ ./perl -Ilib -e 'print join(",",keys %open::layers),"\n"'
nick@dromedary 540$          
nick@dromedary 540$ ./perl -Ilib -MEncode -e 'print join(",",keys %open::layers),"\n"'
nick@dromedary 541$                              

Which demonstrates that what is available depends on what you have loaded.

It also demonstrates issues with "disciplines" which are not layers.
In particular ":raw" means "no layers".
And ":utf8" means set the "is UTF-8 aware flag on top layer".
So neither apear in the list (perhaps hash should have dummy entries).

It also causes this :

nick@dromedary 550$ PERLIO="perlio utf8" ./perl -e 'print chr(0x20AC),"\n"'
perlio: unknown layer "utf8".
Wide character in print at -e line 1.
nick@dromedary 551$                      

>4) I tried C<use open OUT => ":utf8">, it says
>     Can't coerce GLOB to string in concat at /usr/local/perl-5.7.0@8494/lib/5.7.0/Carp/ line 38.

So it does.

>   is this a bug in perl or in my program?

No ;-) it is a bug in

>5) I tried C<use open OUT => ":raw"> within the debugger. It says
>     Unknown discipline layer ':raw' at (eval 30)[/usr/local/perl-5.7.0@8494/lib/5.7.0/] line 2
>   is this a bug in perl or in my program?

See above.

>6) What is "IN" and "OUT" in the manpage for the open pragma? 

A good question.
There was a whole thread on this a few months back.

>   Are
>   these filehandles 


>   or just symbolic names that stand for inout and
>   output to any filehandle in th same scope?

Roughly. Note that what happens for read/write handles is unclear.
One _assumes_ IN => read and OUT => write i.e. sense is wrt to perl,
not the file.

Given that they are not defined very clearly perhaps we could add
TTY => to the list ;-)

Nick Ing-Simmons

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About