New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getc() and ungetc() with unicode failure #12691
Comments
From michael@negativespace.netCreated by michael@negativespace.netThis is a bug report for perl from michael@negativespace.net, getc() is able to get a multibyte unicode character without problem, I've also tested this with files on disk, instead of in-memory See also http://stackoverflow.com/questions/14179751 #!/usr/local/bin/perl use 5.016; use Test::More; binmode(STDIN, ':encoding(utf-8)'); my $string = qq[aÅb]; # use utf8 makes $string UTF-8. $fh->open(\$string, '<:encoding(UTF-8)'); $c = $fh->getc(); done_testing(); __END__ ok 1 __END__ $ perl -v This is perl 5, version 16, subversion 2 (v5.16.2) built for darwin-2level Perl Info
|
From @LeontOn Mon, Jan 7, 2013 at 6:40 AM, Michael Joyce <perlbug-followup@perl.org> wrote:
It seems ungetc is *entirely* unicode-unaware [1]. Looks like this can Leon 1: http://perl5.git.perl.org/perl.git/blob/HEAD:/dist/IO/IO.xs#l327 |
The RT System itself - Status changed from 'new' to 'open' |
From chansen@cpan.orgOn Wed Jan 09 13:37:10 2013, LeonT wrote:
Perhaps something like this: #ifdef PerlIO if ((SvIOK_notUV(c) && SvIV(c) < 0) || (SvNOK(c) && SvNV(c) < 0.0)) v = SvUV(c); if (!PerlIO_isutf8(handle)) end = uvchr_to_utf8_flags(buf, v, 0); /* XXX flags? */ Returning -1 when ungetc() is unsuccessful feels wrong, wouldn't it be more perlish to return undef? -- |
From @khwilliamsonFixed by commit 10e621b |
@khwilliamson - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#116322 (status was 'resolved')
Searchable as RT116322$
The text was updated successfully, but these errors were encountered: