SIGSEGV pri konverzi kodovani?

Jan Kasprzak kas na fi.muni.cz
Úterý Duben 17 10:23:22 CEST 2007


Pavel Smerk wrote:
: [xsmerk na aurora html2]$ cat SIGSEGV.pl
: #!/usr/bin/perl
: use Encode;
: use open ':encoding(iso-8859-2)', ':std';
: print STDERR encode("iso-8859-2", <STDIN>) =~ /^(.)/;
: [xsmerk na aurora html2]$ cat SIGSEGV.in
: ř
: [xsmerk na aurora html2]$ perl SIGSEGV.pl < SIGSEGV.in
: Neoprávněný přístup do paměti (SIGSEGV)
: [xsmerk na aurora html2]$ perl -v
: 
: This is perl, v5.8.8 built for i686-linux

	Zajimave, u me to dela taky (Linux x86_64).
SIGSEGV by to nemelo delat, asi to chces reportovat pres perlbug.
Nicmene kod neni asi uplne korektni, tlacis binarni data pres utf-8
filehandle (STDERR). Kdyz misto toho "use open" das jen
binmode STDIN, ':encoding(iso-8859-2)';
aby STDERR zustal jako bajtovy filehandle, tak to projde.

	Je mozne ze on chce na STDERR vytisknout neco jako
"\x{00f8}" does not map to iso-8859-2, <STDIN> line 1.
coz mu spadne, protoze prave na STDERR tiskne. Nebo tak nejak.
Ale stat by se to nemelo.

-Y.

-- 
| Jan "Yenya" Kasprzak  <kas at {fi.muni.cz - work | yenya.net - private}> |
| GPG: ID 1024/D3498839      Fingerprint 0D99A7FB206605D7 8B35FCDE05B18A5E |
| http://www.fi.muni.cz/~kas/    Journal: http://www.fi.muni.cz/~kas/blog/ |
> I will never go to meetings again because I think  face to face meetings <
> are the biggest waste of time you can ever have.        --Linus Torvalds <


Další informace o konferenci Perl