[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: makeinfo and end-of-line format
From: |
Eli Zaretskii |
Subject: |
Re: makeinfo and end-of-line format |
Date: |
Thu, 11 Jun 2015 16:09:53 +0300 |
> Date: Thu, 11 Jun 2015 01:02:03 +0100
> From: Gavin Smith <address@hidden>
> Cc: address@hidden
>
> On 11 June 2015 at 00:19, Gavin Smith <address@hidden> wrote:
> > I think that the "binmode" command needs to be used for this:
>
> "binmode" is already used in Common.pm (open_out) if the encoding is
> known. When are the \r bytes output under MS-Windows? You can test
> this more easily than me.
>
> Maybe the following is needed:
>
> Index: Texinfo/Common.pm
> ===================================================================
> --- Texinfo/Common.pm (revision 6302)
> +++ Texinfo/Common.pm (working copy)
> @@ -1069,6 +1069,8 @@ sub open_out($$;$)
> binmode($filehandle, ':bytes');
> }
> binmode($filehandle, ":encoding($encoding)");
> + } else {
> + binmode($filehandle);
> }
> if ($self) {
> push @{$self->{'opened_files'}}, $file;
>
Thanks. This only handles the case where the document has no
@documentencoding directive, because a binmode that sets encoding
doesn't disable the crlf layer.
I needed the patch below instead, to make sure any output file is
produced with Unix-style LF-only EOLs.
I think I'd like Patrice's opinion on this because making this change
in open_out means not only Info files, but every file will be opened
in Unix mode. Should we make the change only for Info (in Info.pm)
instead? Also, what about any temporary files that texi2any produces:
could this interfere with them somehow?
Here's the patch that I tested:
--- Texinfo/Common.pm~ 2013-09-28 18:46:17 +0300
+++ Texinfo/Common.pm 2015-06-11 08:34:23 +0300
@@ -1021,6 +1021,7 @@
}
if ($file eq '-') {
+ binmode(STDOUT);
binmode(STDOUT, ":encoding($encoding)") if ($encoding);
if ($self) {
$self->{'unclosed_files'}->{$file} = \*STDOUT;
@@ -1031,6 +1032,7 @@
if (!open ($filehandle, '>', $file)) {
return undef;
}
+ binmode($filehandle);
if ($encoding) {
if ($encoding eq 'utf8' or $encoding eq 'utf-8-strict') {
binmode($filehandle, ':utf8');
- makeinfo and end-of-line format, Eli Zaretskii, 2015/06/10
- Re: makeinfo and end-of-line format, Gavin Smith, 2015/06/10
- Re: makeinfo and end-of-line format, Gavin Smith, 2015/06/10
- Re: makeinfo and end-of-line format,
Eli Zaretskii <=
- Re: makeinfo and end-of-line format, Karl Berry, 2015/06/14
- Re: makeinfo and end-of-line format, Eli Zaretskii, 2015/06/14
- Re: makeinfo and end-of-line format, Gavin Smith, 2015/06/15
- Re: makeinfo and end-of-line format, Patrice Dumas, 2015/06/15
- Re: makeinfo and end-of-line format, Gavin Smith, 2015/06/15
- Re: makeinfo and end-of-line format, Eli Zaretskii, 2015/06/16
- Re: makeinfo and end-of-line format, Gavin Smith, 2015/06/16
- Re: makeinfo and end-of-line format, Eli Zaretskii, 2015/06/18