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
UTF-16 endianess switch after line break #8038
Comments
From jr@terragate.netCreated by jr@terragate.netThis is a bug report for perl from jr@terragate.net, ----------------------------------------------------------------- Example script: #!/usr/bin/perl binmode(STDOUT, ':encoding(UTF-16)'); This produces the following (called with "foo bar baz" as command line params): 0000000: feff 0066 006f 006f 000d 0a00 6200 6100 ...f.o.o....b.a. The carriage return (\r) is correctly outputted as 0xd but after that the In my point of view this looks like a bug in the code that transparently adds So each line break causes a switch from BE to LE and vice versa. Output of the same script on Mac OS X (Perl 5.8.6): 0000000: feff 0066 006f 006f 000a 0062 0061 0072 ...f.o.o...b.a.r No problem here. Perl Info
|
From shouldbedomo@mac.comOn 2005–07–26, at 11:31, Jeremias Reith (via RT) wrote:
The issue seems to be that the implicit push of the :crlf layer onto $ perl -we 'binmode(STDOUT, ":crlf"); binmode(STDOUT, ":encoding The first is wrong, and what I suspect is happening due to the Thanks. |
The RT System itself - Status changed from 'new' to 'open' |
From jr@terragate.netC:\>perl -we "binmode(STDOUT, ':crlf'); binmode(STDOUT, ':encoding(UTF-16)'); |
This persists in 5.31 |
The problem here is that that binmode effectively achieves Binmoding |
Confirmed that that does give the desired result. So what to do about this ticket. Is there some documentation that should be improved? |
I think there are three options:
Actually, there is a fourth option: first doing 2 and later doing 1. |
Option 4 sounds ideal, even if it means having quite a few releases between the two steps. |
A complication with option 2 (and by extension option 4) is that it's only doing the wrong thing for non-ascii-safe encodings (such as utf-16, utf-32). For utf-8 and iso-8859 encodings it does do the right thing because the other of the operations doesn't matter for them. |
I'm assuming that while windows is heavily affected here, it's not a windows bug in particular, right? |
Technically no, practically yes. It takes effort to achieve this on other platforms, it's trivial to accidentally do it on WIndows. |
I think resolving this will require |
Migrated from rt.perl.org#36659 (status was 'open')
Searchable as RT36659$
The text was updated successfully, but these errors were encountered: