[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: different encodings for input and output file names and command line
From: |
Patrice Dumas |
Subject: |
Re: different encodings for input and output file names and command line |
Date: |
Fri, 4 Mar 2022 08:15:54 +0100 |
On Thu, Mar 03, 2022 at 08:13:30PM +0000, Gavin Smith wrote:
> On Tue, Mar 01, 2022 at 01:42:50AM +0100, Patrice Dumas wrote:
> > I commited an implementation. The XS parser part is incomplete, I coded
> > passing the informations, but not using the information, for instance in
> > encode_file_name(). Also encode_file_name() should be used for CPP file
> > directive, as I reported in another mail.
>
> It's going to take me some time to understand what these customization
> variables are supposed to do, if I'm going to implement this in the XS
> code.
>
> Would I be right in saying it is just DOC_ENCODING_FOR_INPUT_FILE_NAME
> and LOCALE_INPUT_FILE_NAME_ENCODING that the XS parser needs to use?
Yes. Beware that I already did some code to pass them to the XS parser.
> Change to Common.pm:
>
> + 'DOC_ENCODING_FOR_INPUT_FILE_NAME' => 1, # if set, use
> LOCALE_INPUT_FILE_NAME_ENCODING
> + # for input file name encoding
This comment is wrong, I'll fix it shortly, thanks.
> Yet the code in encoded_input_file_name seems to do the opposite:
>
> + if ($self->get_conf('DOC_ENCODING_FOR_INPUT_FILE_NAME')) {
> + my $document_encoding;
> + $document_encoding = $self->{'parser_info'}->{'input_perl_encoding'}
> + if ($self->{'parser_info'}
> + and defined($self->{'parser_info'}->{'input_perl_encoding'}));
> + return Texinfo::Common::encode_file_name($self, $file_name,
> + $document_encoding);
> + } else {
> + return Texinfo::Common::encode_file_name($self, $file_name,
> + $self->get_conf('LOCALE_INPUT_FILE_NAME_ENCODING'));
> + }
> +}
The code looks right.
> I'd have thought that LOCALE_INPUT_FILE_NAME_ENCODING would have something
> to do with the locale, but the fact it is a string customization variable
> suggests it could be set to anything on the command line. Is that right?
Yes, as any customization variables.
> I saw it was set in texi2any.pl from the locale. Is it possible to set
> it from the command line too?
Yes, and from init files. Its name comes from the source of information
in the default case.
--
Pat