[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Allow customization of input file name and output
From: |
Patrice Dumas |
Subject: |
branch master updated: Allow customization of input file name and output file name encoding |
Date: |
Mon, 28 Feb 2022 19:40:14 -0500 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 0cd6b977a5 Allow customization of input file name and output file name
encoding
0cd6b977a5 is described below
commit 0cd6b977a566d2dbfcbd500ac9b7bc7dcc112ec5
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Mar 1 01:40:00 2022 +0100
Allow customization of input file name and output file name encoding
* tp/Texinfo/Common.pm, tp/Texinfo/Convert/Converter.pm
(encoded_input_file_name, encoded_output_file_name),
tp/Texinfo/Convert/Utils.pm (expand_verbatiminclude),
tp/Texinfo/ParserNonXS.pm (_encode_file_name),
tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),
tp/Texinfo/XS/parsetexi/Parsetexi.xs, tp/Texinfo/XS/parsetexi/api.c,
tp/Texinfo/XS/parsetexi/conf.c
(conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME)
(set_locale_input_file_name_encoding), tp/texi2any.pl:
rename customization variable
MESSAGE_OUTPUT_ENCODING_NAME as LOCALE_OUTPUT_ENCODING_NAME.
Add DOC_ENCODING_FOR_INPUT_FILE_NAME,
DOC_ENCODING_FOR_OUTPUT_FILE_NAME,
LOCALE_INPUT_FILE_NAME_ENCODING, LOCALE_OUTPUT_FILE_NAME_ENCODING.
separate functions for input and output file names and use
the customization variables to determine if @documentencoding
is used or locale encoding. In the default case, the locale
encoding is used for output, the @documentencoding for input, except
on windows.
---
ChangeLog | 24 ++++++++++++++++++++
tp/DebugTexinfo/DebugTree.pm | 4 ++--
tp/Texinfo/Common.pm | 16 +++++++++++---
tp/Texinfo/Config.pm | 2 +-
tp/Texinfo/Convert/Converter.pm | 43 ++++++++++++++++++++++++++++--------
tp/Texinfo/Convert/DocBook.pm | 6 ++---
tp/Texinfo/Convert/HTML.pm | 16 +++++++-------
tp/Texinfo/Convert/IXIN.pm | 6 ++---
tp/Texinfo/Convert/Info.pm | 6 ++---
tp/Texinfo/Convert/LaTeX.pm | 6 ++---
tp/Texinfo/Convert/TexinfoXML.pm | 4 ++--
tp/Texinfo/Convert/Utils.pm | 12 ++++++++--
tp/Texinfo/ParserNonXS.pm | 22 +++++++++++++-----
tp/Texinfo/XS/parsetexi/Parsetexi.pm | 6 +++++
tp/Texinfo/XS/parsetexi/Parsetexi.xs | 7 ++++++
tp/Texinfo/XS/parsetexi/api.c | 11 +++++++++
tp/Texinfo/XS/parsetexi/api.h | 1 +
tp/Texinfo/XS/parsetexi/conf.c | 7 ++++++
tp/Texinfo/XS/parsetexi/conf.h | 2 ++
tp/Texinfo/XS/parsetexi/parser.c | 1 +
tp/Texinfo/XS/parsetexi/parser.h | 2 ++
tp/init/chm.pm | 6 ++---
tp/init/epub3.pm | 14 ++++++------
tp/init/highlight_syntax.pm | 9 ++++----
tp/init/latex2html.pm | 29 ++++++++++++------------
tp/init/tex4ht.pm | 11 +++++----
tp/texi2any.pl | 15 ++++++++++---
27 files changed, 206 insertions(+), 82 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 62cfd1545f..290ff2dbb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2022-02-28 Patrice Dumas <pertusus@free.fr>
+
+ Allow customization of input file name and output file name encoding
+
+ * tp/Texinfo/Common.pm, tp/Texinfo/Convert/Converter.pm
+ (encoded_input_file_name, encoded_output_file_name),
+ tp/Texinfo/Convert/Utils.pm (expand_verbatiminclude),
+ tp/Texinfo/ParserNonXS.pm (_encode_file_name),
+ tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser),
+ tp/Texinfo/XS/parsetexi/Parsetexi.xs, tp/Texinfo/XS/parsetexi/api.c,
+ tp/Texinfo/XS/parsetexi/conf.c
+ (conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME)
+ (set_locale_input_file_name_encoding), tp/texi2any.pl:
+ rename customization variable
+ MESSAGE_OUTPUT_ENCODING_NAME as LOCALE_OUTPUT_ENCODING_NAME.
+ Add DOC_ENCODING_FOR_INPUT_FILE_NAME,
+ DOC_ENCODING_FOR_OUTPUT_FILE_NAME,
+ LOCALE_INPUT_FILE_NAME_ENCODING, LOCALE_OUTPUT_FILE_NAME_ENCODING.
+ separate functions for input and output file names and use
+ the customization variables to determine if @documentencoding
+ is used or locale encoding. In the default case, the locale
+ encoding is used for output, the @documentencoding for input, except
+ on windows.
+
2022-02-28 Patrice Dumas <pertusus@free.fr>
Decode/encode fixes
diff --git a/tp/DebugTexinfo/DebugTree.pm b/tp/DebugTexinfo/DebugTree.pm
index 427e44fdc0..a58d025643 100644
--- a/tp/DebugTexinfo/DebugTree.pm
+++ b/tp/DebugTexinfo/DebugTree.pm
@@ -83,7 +83,7 @@ sub output($$)
}
my ($encoded_destination_directory, $dir_encoding)
- = $self->encoded_file_name($destination_directory);
+ = $self->encoded_output_file_name($destination_directory);
my ($succeeded, $created_directory)
= $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
@@ -93,7 +93,7 @@ sub output($$)
if (! $output_file eq '') {
my $path_encoding;
($encoded_output_file, $path_encoding)
- = $self->encoded_file_name($output_file);
+ = $self->encoded_output_file_name($output_file);
$fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_output_file);
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index b04ae79c49..5cfff7e0b8 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -108,6 +108,8 @@ my %default_parser_common_customization = (
'DEBUG' => 0, # if >= 10, tree is printed in texi2any.pl after parsing.
# If >= 100 tree is printed every line.
'FORMAT_MENU' => 'menu', # if not 'menu' no menu error related.
+ 'DOC_ENCODING_FOR_INPUT_FILE_NAME' => 1, # if set, use
LOCALE_INPUT_FILE_NAME_ENCODING
+ # for input file name encoding
);
# Customization variables obeyed only by the parser, and the default values.
@@ -254,6 +256,10 @@ our %default_converter_customization = (
'DEBUG' => 0,
'TEST' => 0,
'TEXTCONTENT_COMMENT', => undef, # in textcontent format
+ 'DOC_ENCODING_FOR_INPUT_FILE_NAME' => 1, # if set, use
LOCALE_INPUT_FILE_NAME_ENCODING
+ # for input file name encoding
+ 'DOC_ENCODING_FOR_OUTPUT_FILE_NAME' => 0, # if set, use
LOCALE_OUTPUT_FILE_NAME_ENCODING
+ # for output file name encoding
);
# Some are for all converters, EXTENSION for instance, some for
@@ -281,6 +287,8 @@ my @variable_string_settables = (
'DEFAULT_RULE',
'DEF_TABLE',
'DO_ABOUT',
+'DOC_ENCODING_FOR_INPUT_FILE_NAME',
+'DOC_ENCODING_FOR_OUTPUT_FILE_NAME',
'DOCTYPE',
'EXTENSION',
'EXTERNAL_CROSSREF_EXTENSION',
@@ -319,7 +327,9 @@ my @variable_string_settables = (
'MAX_HEADER_LEVEL',
'MENU_ENTRY_COLON',
'MENU_SYMBOL',
-'MESSAGE_OUTPUT_ENCODING_NAME',
+'LOCALE_OUTPUT_ENCODING_NAME',
+'LOCALE_INPUT_FILE_NAME_ENCODING',
+'LOCALE_OUTPUT_FILE_NAME_ENCODING',
'MONOLITHIC',
'NO_CSS',
'NO_NUMBER_FOOTNOTE_SYMBOL',
@@ -1512,7 +1522,7 @@ sub parse_node_manual($)
# ASCII, as the name of the directory it is located within may contain
# non-ASCII characters.
# Otherwise, the -e operator and similar may not work correctly.
-# TODO document and add the possibility to use configuration_information
+# TODO document. Use configuration_information?
sub encode_file_name($$;$)
{
my $configuration_information = shift;
@@ -1525,7 +1535,7 @@ sub encode_file_name($$;$)
or $input_encoding eq 'utf-8-strict')) {
utf8::encode($file_name);
$encoding = 'utf-8';
- } else {
+ } elsif (defined($input_encoding)) {
$file_name = Encode::encode($input_encoding, $file_name);
$encoding = $input_encoding;
}
diff --git a/tp/Texinfo/Config.pm b/tp/Texinfo/Config.pm
index a2573aa2f9..dc06aa664d 100644
--- a/tp/Texinfo/Config.pm
+++ b/tp/Texinfo/Config.pm
@@ -87,7 +87,7 @@ sub GNUT_initialize_config($$$) {
sub _GNUT_encode_message($)
{
my $text = shift;
- my $encoding = texinfo_get_conf('MESSAGE_OUTPUT_ENCODING_NAME');
+ my $encoding = texinfo_get_conf('LOCALE_OUTPUT_ENCODING_NAME');
if (defined($encoding)) {
return Encode::encode($encoding, $text);
} else {
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 3ae8602fc5..f126d1d2ea 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -321,7 +321,7 @@ sub output($$)
my ($output_file, $destination_directory, $output_filename,
$document_name) = $self->determine_files_and_directory();
my ($encoded_destination_directory, $dir_encoding)
- = $self->encoded_file_name($destination_directory);
+ = $self->encoded_output_file_name($destination_directory);
my ($succeeded, $created_directory)
= $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
@@ -365,7 +365,7 @@ sub output($$)
if ($self->get_conf('DEBUG'));
my $path_encoding;
($encoded_outfile_name, $path_encoding)
- = $self->encoded_file_name($outfile_name);
+ = $self->encoded_output_file_name($outfile_name);
$fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_outfile_name);
@@ -1030,16 +1030,41 @@ sub present_bug_message($$;$)
# Reverse the decoding of the file name from the input encoding.
# TODO document
-sub encoded_file_name($$)
+sub encoded_input_file_name($$)
{
my $self = shift;
my $file_name = shift;
- 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);
+ 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'));
+ }
+}
+
+# TODO document
+sub encoded_output_file_name($$)
+{
+ my $self = shift;
+ my $file_name = shift;
+
+ if ($self->get_conf('DOC_ENCODING_FOR_OUTPUT_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_OUTPUT_FILE_NAME_ENCODING'));
+ }
}
sub txt_image_text($$$)
@@ -1047,7 +1072,7 @@ sub txt_image_text($$$)
my ($self, $element, $basefile) = @_;
my ($text_file_name, $file_name_encoding)
- = $self->encoded_file_name($basefile.'.txt');
+ = $self->encoded_input_file_name($basefile.'.txt');
my $txt_file = Texinfo::Common::locate_include_file($self, $text_file_name);
if (!defined($txt_file)) {
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 67dc868d2c..dd1484f50d 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -307,7 +307,7 @@ sub output($$)
= $self->determine_files_and_directory();
my ($encoded_destination_directory, $dir_encoding)
- = $self->encoded_file_name($destination_directory);
+ = $self->encoded_output_file_name($destination_directory);
my ($succeeded, $created_directory)
= $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
@@ -317,7 +317,7 @@ sub output($$)
if (! $output_file eq '') {
my $path_encoding;
($encoded_output_file, $path_encoding)
- = $self->encoded_file_name($output_file);
+ = $self->encoded_output_file_name($output_file);
$fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_output_file);
@@ -1126,7 +1126,7 @@ sub _convert($$;$)
my @files;
foreach my $extension (@docbook_image_extensions) {
my ($file_name, $file_name_encoding)
- = $self->encoded_file_name("$basefile.$extension");
+ = $self->encoded_input_file_name("$basefile.$extension");
if ($self->Texinfo::Common::locate_include_file($file_name)) {
push @files, ["$basefile.$extension", uc($extension)];
}
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 5ab3c2fddf..2305602e40 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -272,7 +272,7 @@ sub html_image_file_location_name($$$$)
}
foreach my $extension (@extensions) {
my ($file_name, $file_name_encoding)
- = $self->encoded_file_name($image_basefile.$extension);
+ = $self->encoded_input_file_name($image_basefile.$extension);
my $located_image_path
= $self->Texinfo::Common::locate_include_file($file_name);
if (defined($located_image_path) and $located_image_path ne '') {
@@ -8922,7 +8922,7 @@ __("cannot use absolute path or URL `%s' for
JS_WEBLABELS_FILE when generating w
$path);
# sequence of bytes
my ($licence_file_path, $path_encoding)
- = $self->encoded_file_name($license_file);
+ = $self->encoded_output_file_name($license_file);
my $fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$licence_file_path);
@@ -8970,7 +8970,7 @@ sub _default_format_frame_files($$)
}
# sequence of bytes
my ($frame_file_path, $frame_path_encoding)
- = $self->encoded_file_name($frame_outfile);
+ = $self->encoded_output_file_name($frame_outfile);
my $frame_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$frame_file_path);
if (defined($frame_fh)) {
@@ -9009,7 +9009,7 @@ EOT
}
# sequence of bytes
my ($toc_frame_path, $toc_frame_path_encoding)
- = $self->encoded_file_name($toc_frame_outfile);
+ = $self->encoded_output_file_name($toc_frame_outfile);
my $toc_frame_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$toc_frame_path);
@@ -9309,7 +9309,7 @@ sub output($$)
my ($output_file, $destination_directory, $output_filename,
$document_name) = $self->determine_files_and_directory();
my ($encoded_destination_directory, $dir_encoding)
- = $self->encoded_file_name($destination_directory);
+ = $self->encoded_output_file_name($destination_directory);
my ($succeeded, $created_directory)
= $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
@@ -9515,7 +9515,7 @@ sub output($$)
}
my $path_encoding;
($encoded_no_page_out_filepath, $path_encoding)
- = $self->encoded_file_name($no_page_out_filepath);
+ = $self->encoded_output_file_name($no_page_out_filepath);
$fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_no_page_out_filepath);
@@ -9620,7 +9620,7 @@ sub output($$)
if ($self->{'file_counters'}->{$element_filename} == 0) {
my $file_element = $files{$element_filename}->{'first_element'};
my ($encoded_out_filepath, $path_encoding)
- = $self->encoded_file_name($out_filepath);
+ = $self->encoded_output_file_name($out_filepath);
my $file_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_out_filepath);
@@ -9731,7 +9731,7 @@ sub output($$)
$out_filename = $node_filename;
}
my ($encoded_out_filename, $path_encoding)
- = $self->encoded_file_name($out_filename);
+ = $self->encoded_output_file_name($out_filename);
my $file_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_out_filename);
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index fde5be0ffb..af925e42a4 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -270,7 +270,7 @@ sub output_ixin($$)
my ($outfile, $destination_directory) =
$self->determine_files_and_directory();
my ($encoded_destination_directory, $dir_encoding)
- = $self->encoded_file_name($destination_directory);
+ = $self->encoded_output_file_name($destination_directory);
my ($succeeded, $created_directory)
= $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
@@ -280,7 +280,7 @@ sub output_ixin($$)
if (! $output_file eq '') {
my $path_encoding;
($encoded_output_file, $path_encoding)
- = $self->encoded_file_name($output_file);
+ = $self->encoded_output_file_name($output_file);
$fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_output_file);
@@ -846,7 +846,7 @@ sub output_ixin($$)
foreach my $extension (@extension, @image_files_extensions) {
my $file_name_text = "$basefile.$extension";
my ($file_name, $file_name_encoding)
- = $self->encoded_file_name($file_name_text);
+ = $self->encoded_input_file_name($file_name_text);
my $file = $self->Texinfo::Common::locate_include_file($file_name);
if (defined($file)) {
my $filehandle = do { local *FH };
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 5ea46e192d..9b2a1dd2e8 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -298,7 +298,7 @@ sub _open_info_file($$)
my $filename = shift;
my ($encoded_filename, $path_encoding)
- = $self->encoded_file_name($filename);
+ = $self->encoded_output_file_name($filename);
my $fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_filename, 'use_binmode');
@@ -318,7 +318,7 @@ sub _register_closed_info_file($$)
my $filename = shift;
my ($encoded_filename, $path_encoding)
- = $self->encoded_file_name($filename);
+ = $self->encoded_output_file_name($filename);
Texinfo::Common::output_files_register_closed(
$self->output_files_information(), $encoded_filename)
@@ -521,7 +521,7 @@ sub format_image($$)
my $image_file;
foreach my $extension (@extensions) {
my ($file_name, $file_name_encoding)
- = $self->encoded_file_name($basefile.$extension);
+ = $self->encoded_input_file_name($basefile.$extension);
if ($self->Texinfo::Common::locate_include_file($file_name)) {
# use the basename and not the file found. It is agreed that it is
# better, since in any case the files are moved.
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 56373db3c0..f75c2e2cd9 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -916,7 +916,7 @@ sub output($$)
= $self->determine_files_and_directory();
my ($encoded_destination_directory, $dir_encoding)
- = $self->encoded_file_name($destination_directory);
+ = $self->encoded_output_file_name($destination_directory);
my ($succeeded, $created_directory)
= $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
@@ -926,7 +926,7 @@ sub output($$)
if (! $output_file eq '') {
my $path_encoding;
($encoded_output_file, $path_encoding)
- = $self->encoded_file_name($output_file);
+ = $self->encoded_output_file_name($output_file);
$fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_output_file);
@@ -2316,7 +2316,7 @@ sub _convert($$)
my $image_file;
foreach my $extension (@LaTeX_image_extensions) {
my ($file_name, $file_name_encoding)
- = $self->encoded_file_name("$basefile.$extension");
+ = $self->encoded_input_file_name("$basefile.$extension");
my $located_file =
$self->Texinfo::Common::locate_include_file($file_name);
if (defined($located_file)) {
diff --git a/tp/Texinfo/Convert/TexinfoXML.pm b/tp/Texinfo/Convert/TexinfoXML.pm
index d00e8ecf65..37e86bc542 100644
--- a/tp/Texinfo/Convert/TexinfoXML.pm
+++ b/tp/Texinfo/Convert/TexinfoXML.pm
@@ -429,7 +429,7 @@ sub output($$)
= $self->determine_files_and_directory();
my ($encoded_destination_directory, $dir_encoding)
- = $self->encoded_file_name($destination_directory);
+ = $self->encoded_output_file_name($destination_directory);
my ($succeeded, $created_directory)
= $self->create_destination_directory($encoded_destination_directory);
return undef unless $succeeded;
@@ -440,7 +440,7 @@ sub output($$)
if (! $output_file eq '') {
my $path_encoding;
($encoded_output_file, $path_encoding)
- = $self->encoded_file_name($output_file);
+ = $self->encoded_output_file_name($output_file);
$fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_output_file);
diff --git a/tp/Texinfo/Convert/Utils.pm b/tp/Texinfo/Convert/Utils.pm
index 218a986f7e..17952f11f3 100644
--- a/tp/Texinfo/Convert/Utils.pm
+++ b/tp/Texinfo/Convert/Utils.pm
@@ -204,10 +204,18 @@ sub expand_verbatiminclude($$$)
$input_encoding = $current->{'extra'}->{'input_perl_encoding'}
if (defined($current->{'extra'}->{'input_perl_encoding'}));
- my ($file_name, $file_name_encoding)
- = Texinfo::Common::encode_file_name($configuration_information,
+ my ($file_name, $file_name_encoding);
+ if
($configuration_information->get_conf('DOC_ENCODING_FOR_INPUT_FILE_NAME')) {
+ ($file_name, $file_name_encoding)
+ = Texinfo::Common::encode_file_name($configuration_information,
$file_name_text,
$input_encoding);
+ } else {
+ ($file_name, $file_name_encoding)
+ = Texinfo::Common::encode_file_name($configuration_information,
+ $file_name_text,
+ $configuration_information->get_conf('LOCALE_INPUT_FILE_NAME_ENCODING'));
+ }
my $file = Texinfo::Common::locate_include_file($configuration_information,
$file_name);
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index ac48d2c1a0..6b438265a7 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -1982,6 +1982,21 @@ sub _item_multitable_parent($)
return undef;
}
+sub _encode_file_name($$)
+{
+ my ($self, $file_name) = @_;
+
+ my ($encoded_file_name, $file_name_encoding);
+
+ if ($self->get_conf('DOC_ENCODING_FOR_INPUT_FILE_NAME')) {
+ return Texinfo::Common::encode_file_name($self, $file_name,
+ $self->{'info'}->{'input_perl_encoding'});
+ } else {
+ return Texinfo::Common::encode_file_name($self, $file_name,
+ $self->get_conf('LOCALE_INPUT_FILE_NAME_ENCODING'));
+ }
+}
+
sub _save_line_directive
{
my ($self, $line_nr, $file_name) = @_;
@@ -1992,8 +2007,7 @@ sub _save_line_directive
# need to convert to bytes for file name
if (defined($file_name)) {
my ($encoded_file_name, $file_name_encoding)
- = Texinfo::Common::encode_file_name($self, $file_name,
- $self->{'info'}->{'input_perl_encoding'});
+ = _encode_file_name($self, $file_name);
$input->{'name'} = $encoded_file_name;
}
}
@@ -3214,9 +3228,7 @@ sub _end_line($$$)
} elsif ($command eq 'include') {
# We want Perl strings representing sequences
# of bytes, not codepoints in the internal perl encoding.
- my ($file_name, $file_name_encoding)
- = Texinfo::Common::encode_file_name($self, $text,
- $self->{'info'}->{'input_perl_encoding'});
+ my ($file_name, $file_name_encoding) = _encode_file_name($self,
$text);
my $file = Texinfo::Common::locate_include_file($self, $file_name);
if (defined($file)) {
my $filehandle = do { local *FH };
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index 3ada1cd9a5..a2604e6696 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -116,6 +116,12 @@ sub parser (;$$)
conf_set_CPP_LINE_DIRECTIVES($conf->{$key});
} elsif ($key eq 'DEBUG') {
set_debug($conf->{$key}) if $conf->{$key};
+ } elsif ($key eq 'DOC_ENCODING_FOR_INPUT_FILE_NAME') {
+ conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME ($conf->{$key});
+ } elsif ($key eq 'LOCALE_INPUT_FILE_NAME_ENCODING') {
+ if (defined ($conf->{$key})) {
+ set_locale_input_file_name_encoding ($conf->{$key});
+ }
} elsif ($key eq 'accept_internalvalue') {
set_accept_internalvalue();
} elsif ($key eq 'registrar') {
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.xs
b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
index 2d19445587..d75bce9dfe 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.xs
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
@@ -106,6 +106,13 @@ conf_set_CPP_LINE_DIRECTIVES (int i)
void
conf_set_IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME (int i)
+void
+conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i)
+
+void
+set_locale_input_file_name_encoding (value)
+ char *value
+
void
set_documentlanguage_override (value)
char *value
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 3ed7314cbb..f68d7235f5 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -149,6 +149,9 @@ reset_parser (void)
global_documentlanguage = 0;
global_documentlanguage_fixed = 0;
+ free (locale_input_file_name_encoding);
+ locale_input_file_name_encoding = 0;
+
global_accept_internalvalue = 0;
}
@@ -1098,6 +1101,14 @@ set_documentlanguage_override (char *value)
global_documentlanguage_fixed = 1;
}
+/* used if conf.doc_encoding_for_input_file_name is 0 */
+void
+set_locale_input_file_name_encoding (char *value)
+{
+ free (locale_input_file_name_encoding);
+ locale_input_file_name_encoding = strdup (value);
+}
+
static SV *
diff --git a/tp/Texinfo/XS/parsetexi/api.h b/tp/Texinfo/XS/parsetexi/api.h
index 361d68d8de..0beb464b0f 100644
--- a/tp/Texinfo/XS/parsetexi/api.h
+++ b/tp/Texinfo/XS/parsetexi/api.h
@@ -15,6 +15,7 @@ void set_debug (int);
void wipe_values (void);
void reset_context_stack (void);
void set_documentlanguage_override (char *value);
+void set_locale_input_file_name_encoding (char *value);
HV *build_texinfo_tree (void);
diff --git a/tp/Texinfo/XS/parsetexi/conf.c b/tp/Texinfo/XS/parsetexi/conf.c
index 4d734942bb..8fa65fe445 100644
--- a/tp/Texinfo/XS/parsetexi/conf.c
+++ b/tp/Texinfo/XS/parsetexi/conf.c
@@ -40,6 +40,12 @@ conf_set_IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME (int i)
conf.ignore_space_after_braced_command_name = i;
}
+void
+conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i)
+{
+ conf.doc_encoding_for_input_file_name = i;
+}
+
void
reset_conf (void)
{
@@ -47,4 +53,5 @@ reset_conf (void)
conf.show_menu = 1;
conf.cpp_line_directives = 1;
conf.ignore_space_after_braced_command_name = 1;
+ conf.doc_encoding_for_input_file_name = 1;
}
diff --git a/tp/Texinfo/XS/parsetexi/conf.h b/tp/Texinfo/XS/parsetexi/conf.h
index 7efcb566b3..e2ff3e779e 100644
--- a/tp/Texinfo/XS/parsetexi/conf.h
+++ b/tp/Texinfo/XS/parsetexi/conf.h
@@ -20,6 +20,7 @@ typedef struct CONF {
int show_menu;
int cpp_line_directives;
int ignore_space_after_braced_command_name;
+ int doc_encoding_for_input_file_name;
} CONF;
extern CONF conf;
@@ -27,6 +28,7 @@ extern CONF conf;
void conf_set_show_menu (int i);
void conf_set_CPP_LINE_DIRECTIVES (int i);
void conf_set_IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME (int i);
+void conf_set_DOC_ENCODING_FOR_INPUT_FILE_NAME (int i);
void reset_conf (void);
#endif
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index ac5f104a9d..17adc0b740 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -138,6 +138,7 @@ char *global_clickstyle = 0;
char *global_documentlanguage = 0;
int global_documentlanguage_fixed = 0;
int global_accept_internalvalue = 0;
+char *locale_input_file_name_encoding = 0;
enum kbd_enum global_kbdinputstyle = kbd_distinct;
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index 186e31f7fa..388f714fe6 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -189,6 +189,8 @@ extern char *global_documentlanguage;
extern int global_documentlanguage_fixed;
extern int global_accept_internalvalue;
+extern char *locale_input_file_name_encoding;
+
enum kbd_enum {kbd_none, kbd_code, kbd_example, kbd_distinct };
extern enum kbd_enum global_kbdinputstyle;
diff --git a/tp/init/chm.pm b/tp/init/chm.pm
index e5992642ff..595eeb1743 100644
--- a/tp/init/chm.pm
+++ b/tp/init/chm.pm
@@ -216,7 +216,7 @@ sub chm_init($)
my $hhk_filename = $document_name . ".hhk";
my $hhk_file_path_name = File::Spec->catfile($outdir, $hhk_filename);
my ($encoded_hhk_file_path_name, $hhk_path_encoding)
- = $self->encoded_file_name($hhk_file_path_name);
+ = $self->encoded_output_file_name($hhk_file_path_name);
my $hhk_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_hhk_file_path_name);
@@ -266,7 +266,7 @@ sub chm_init($)
my $hhc_filename = $document_name . ".hhc";
my $hhc_file_path_name = File::Spec->catfile($outdir, $hhc_filename);
my ($encoded_hhc_file_path_name, $hhc_path_encoding)
- = $self->encoded_file_name($hhc_file_path_name);
+ = $self->encoded_output_file_name($hhc_file_path_name);
my $hhc_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_hhc_file_path_name);
@@ -344,7 +344,7 @@ sub chm_init($)
my $hhp_filename = $document_name . ".hhp";
my $hhp_file_path_name = File::Spec->catfile($outdir, $hhp_filename);
my ($encoded_hhp_file_path_name, $hhp_path_encoding)
- = $self->encoded_file_name($hhp_file_path_name);
+ = $self->encoded_output_file_name($hhp_file_path_name);
my $hhp_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_hhp_file_path_name);
diff --git a/tp/init/epub3.pm b/tp/init/epub3.pm
index bcb5b32141..9ac691743c 100644
--- a/tp/init/epub3.pm
+++ b/tp/init/epub3.pm
@@ -168,7 +168,7 @@ sub epub_convert_image_command($$$$)
= File::Spec->catdir($epub_destination_directory,
$epub_document_dir_name,
$epub_images_dir_name);
my ($encoded_images_destination_dir, $images_destination_dir_encoding)
- = $self->encoded_file_name($images_destination_dir);
+ = $self->encoded_output_file_name($images_destination_dir);
if (! -d $encoded_images_destination_dir) {
if (!mkdir($encoded_images_destination_dir, oct(755))) {
$self->document_error($self, sprintf(__(
@@ -180,7 +180,7 @@ sub epub_convert_image_command($$$$)
my $image_destination_path_name
= File::Spec->catfile($images_destination_dir, $image_file);
my ($encoded_image_dest_path_name, $image_dest_path_encoding)
- = $self->encoded_file_name($image_destination_path_name);
+ = $self->encoded_output_file_name($image_destination_path_name);
my $copy_succeeded = copy($image_path, $encoded_image_dest_path_name);
if (not $copy_succeeded) {
my $image_path_text;
@@ -355,7 +355,7 @@ sub epub_finish($$)
my $meta_inf_directory = File::Spec->catdir($epub_destination_directory,
$meta_inf_directory_name);
my ($encoded_meta_inf_directory, $meta_inf_directory_encoding)
- = $self->encoded_file_name($meta_inf_directory);
+ = $self->encoded_output_file_name($meta_inf_directory);
if (!mkdir($encoded_meta_inf_directory, oct(755))) {
$self->document_error($self, sprintf(__(
"could not create directory `%s': %s"),
@@ -365,7 +365,7 @@ sub epub_finish($$)
my $container_file_path_name = File::Spec->catfile($meta_inf_directory,
'container.xml');
my ($encoded_container_file_path_name, $container_path_encoding)
- = $self->encoded_file_name($container_file_path_name);
+ = $self->encoded_output_file_name($container_file_path_name);
my $container_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_container_file_path_name, undef, 'utf-8');
@@ -400,7 +400,7 @@ EOT
my $mimetype_file_path_name =
File::Spec->catfile($epub_destination_directory,
$mimetype_filename);
my ($encoded_mimetype_file_path_name, $mimetype_path_encoding)
- = $self->encoded_file_name($mimetype_file_path_name);
+ = $self->encoded_output_file_name($mimetype_file_path_name);
my $mimetype_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_mimetype_file_path_name, undef, 'utf-8');
@@ -427,7 +427,7 @@ EOT
$nav_file_path_name
= File::Spec->catfile($epub_document_destination_directory,
$nav_filename);
my ($encoded_nav_file_path_name, $nav_path_encoding)
- = $self->encoded_file_name($nav_file_path_name);
+ = $self->encoded_output_file_name($nav_file_path_name);
my $nav_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_nav_file_path_name, undef, 'utf-8');
@@ -528,7 +528,7 @@ EOT
my $opf_file_path_name = File::Spec->catfile($epub_destination_directory,
$epub_document_dir_name,
$opf_filename);
my ($encoded_opf_file_path_name, $opf_path_encoding)
- = $self->encoded_file_name($opf_file_path_name);
+ = $self->encoded_output_file_name($opf_file_path_name);
my $opf_fh = Texinfo::Common::output_files_open_out(
$self->output_files_information(), $self,
$encoded_opf_file_path_name, undef, 'utf-8');
diff --git a/tp/init/highlight_syntax.pm b/tp/init/highlight_syntax.pm
index 33549ce82f..f184efd2a7 100644
--- a/tp/init/highlight_syntax.pm
+++ b/tp/init/highlight_syntax.pm
@@ -188,7 +188,7 @@ sub highlight_process($$)
# expand @example texts in an input file for highlight source
# program
my ($encoded_input_language_path_name, $input_language_path_encoding)
- = $self->encoded_file_name($input_language_path_name);
+ = $self->encoded_output_file_name($input_language_path_name);
unless (open (HIGHLIGHT_LANG_IN, ">$encoded_input_language_path_name")) {
$self->document_warn($self,
sprintf(__("highlight_syntax.pm: could not open %s: %s"),
@@ -240,8 +240,7 @@ sub highlight_process($$)
my $option_line_range_str = join(',', @option_line_ranges);
my $cmd = "source-highlight ${version_option}--src-lang=$language
--out-format=html5 -i '$input_language_path_name' -o '$html_result_path_name'
--line-range=$option_line_range_str --range-separator='$range_separator'";
- # FIXME do not know what would be better here
- my $encoding = $self->get_conf('MESSAGE_OUTPUT_ENCODING_NAME');
+ my $encoding = $self->get_conf('LOCALE_OUTPUT_ENCODING_NAME');
my $encoded_cmd;
if (defined($encoding)) {
$encoded_cmd = encode($encoding, $cmd);
@@ -258,8 +257,8 @@ sub highlight_process($$)
my $language_fragments_nr = $languages{$language}->{'counter'};
# extract highlighted fragments
my ($encoded_html_result_path_name, $html_result_path_encoding)
- = $self->encoded_file_name($html_result_path_name);
- unless (open (HIGHLIGHT_LANG_OUT, $encoded_html_result_path_name)) {
+ = $self->encoded_output_file_name($html_result_path_name);
+ unless (open(HIGHLIGHT_LANG_OUT, $encoded_html_result_path_name)) {
$self->document_warn($self,
sprintf(__("highlight_syntax.pm: could not open %s: %s"),
$html_result_path_name, $!));
diff --git a/tp/init/latex2html.pm b/tp/init/latex2html.pm
index 5482d1a459..76d577a210 100644
--- a/tp/init/latex2html.pm
+++ b/tp/init/latex2html.pm
@@ -198,7 +198,7 @@ sub l2h_process($$)
unless ($self->get_conf('L2H_SKIP')) {
my ($encoded_l2h_latex_path_name, $l2h_latex_path_encoding)
- = $self->encoded_file_name($l2h_latex_path_name);
+ = $self->encoded_output_file_name($l2h_latex_path_name);
unless (open(L2H_LATEX, ">$encoded_l2h_latex_path_name")) {
$self->document_error($self, sprintf(__(
"l2h: could not open latex file %s for writing: %s"),
@@ -368,8 +368,10 @@ sub l2h_to_html($)
$call = $latex2html_command;
# use init file, if specified
my $init_file = $self->get_conf('L2H_FILE');
+ # FIXME not clear whether encoded_input_file_name or encoded_output_file_name
+ # should be used here
my ($encoded_init_file, $init_path_encoding)
- = $self->encoded_file_name($init_file);
+ = $self->encoded_input_file_name($init_file);
$call .= " -init_file " . $init_file
if (defined($init_file) and $init_file ne ''
and -f $encoded_init_file and -r $encoded_init_file);
@@ -387,8 +389,7 @@ sub l2h_to_html($)
$call .= " -address 0 -info 0 -split 0 -no_navigation -no_auto_link";
$call .= " -prefix $l2h_prefix $l2h_latex_path_name";
- # FIXME do not know what would be better here
- my $encoding = $self->get_conf('MESSAGE_OUTPUT_ENCODING_NAME');
+ my $encoding = $self->get_conf('LOCALE_OUTPUT_ENCODING_NAME');
my $encoded_call;
if (defined($encoding)) {
$encoded_call = encode($encoding, $call);
@@ -453,7 +454,7 @@ sub l2h_change_image_file_names($$)
my $image_file_path_name = File::Spec->catpath($docu_volume,
$docu_directories, $image_file_name);
my ($encoded_image_file_path_name, $image_path_encoding)
- = $self->encoded_file_name($image_file_path_name);
+ = $self->encoded_output_file_name($image_file_path_name);
unless (-e $encoded_image_file_path_name) {
last;
}
@@ -462,12 +463,12 @@ sub l2h_change_image_file_names($$)
my $file_src
= File::Spec->catpath($docu_volume, $docu_directories, $src);
my ($encoded_file_src, $src_file_encoding)
- = $self->encoded_file_name($file_src);
+ = $self->encoded_output_file_name($file_src);
$dest = "${docu_name}_${image_count}$ext";
my $file_dest
= File::Spec->catpath($docu_volume, $docu_directories, $dest);
my ($encoded_file_dest, $dest_file_encoding)
- = $self->encoded_file_name($file_dest);
+ = $self->encoded_output_file_name($file_dest);
if ($debug) {
copy($encoded_file_src, $encoded_file_dest);
} else {
@@ -495,7 +496,7 @@ sub l2h_init_from_html($)
}
my ($encoded_l2h_html_path_name, $l2h_html_path_encoding)
- = $self->encoded_file_name($l2h_html_path_name);
+ = $self->encoded_output_file_name($l2h_html_path_name);
if (! open(L2H_HTML, "<$encoded_l2h_html_path_name")) {
$self->document_warn($self,
sprintf(__("l2h: could not open %s: %s"),
@@ -639,11 +640,11 @@ sub l2h_finish($)
my $quoted_l2h_name = quotemeta($l2h_name);
my $dir = $docu_rdir;
$dir = File::Spec->curdir() if ($dir eq '');
- my ($encoded_dir, $dir_encoding) = $self->encoded_file_name($dir);
+ my ($encoded_dir, $dir_encoding) = $self->encoded_output_file_name($dir);
my ($encoded_docu_directories, $docu_directories_encoding)
- = $self->encoded_file_name($docu_directories);
+ = $self->encoded_output_file_name($docu_directories);
my ($encoded_docu_volume, $docu_volume_encoding)
- = $self->encoded_file_name($docu_volume);
+ = $self->encoded_output_file_name($docu_volume);
if (opendir (DIR, $encoded_dir)) {
foreach my $file (readdir(DIR)) {
# FIXME there is a mix of files created by texi2any and files
@@ -676,7 +677,7 @@ sub l2h_init_cache($)
{
my $self = shift;
my ($encoded_l2h_cache_path_name, $l2h_cache_path_encoding)
- = $self->encoded_file_name($l2h_cache_path_name);
+ = $self->encoded_output_file_name($l2h_cache_path_name);
if (-r $encoded_l2h_cache_path_name) {
my $rdo = do "$encoded_l2h_cache_path_name";
$self->document_error($self,
@@ -693,7 +694,7 @@ sub l2h_store_cache($)
return unless $latex_count;
my ($key, $value);
my ($encoded_l2h_cache_path_name, $l2h_cache_path_encoding)
- = $self->encoded_file_name($l2h_cache_path_name);
+ = $self->encoded_output_file_name($l2h_cache_path_name);
unless (open(FH, ">$encoded_l2h_cache_path_name")) {
$self->document_error($self,
sprintf(__("l2h: could not open %s for writing: %s"),
@@ -735,7 +736,7 @@ sub l2h_from_cache($$)
my $cached_image_path_name = File::Spec->catpath($docu_volume,
$docu_directories, $cached_image_file_name);
my ($encoded_cached_image_path_name, $cached_image_path_encoding)
- = $self->encoded_file_name($cached_image_path_name);
+ = $self->encoded_output_file_name($cached_image_path_name);
unless (-e $encoded_cached_image_path_name) {
return undef;
}
diff --git a/tp/init/tex4ht.pm b/tp/init/tex4ht.pm
index 2eb27bd24d..d1c70b8c59 100644
--- a/tp/init/tex4ht.pm
+++ b/tp/init/tex4ht.pm
@@ -136,18 +136,18 @@ sub tex4ht_prepare($$)
$formats{$format}->{'basefile_name'}
= $formats{$format}->{'basename'} . $suffix;
my ($encoded_basefile_name, $basefile_name_encoding)
- = $self->encoded_file_name($formats{$format}->{'basefile_name'});
+ = $self->encoded_output_file_name($formats{$format}->{'basefile_name'});
$formats{$format}->{'basefile_path'} = $encoded_basefile_name;
$formats{$format}->{'html_basefile_name'}
= $formats{$format}->{'basename'} . '.html';
my ($encoded_html_basefile_name, $html_basefile_name_encoding)
- = $self->encoded_file_name($formats{$format}->{'html_basefile_name'});
+ =
$self->encoded_output_file_name($formats{$format}->{'html_basefile_name'});
$formats{$format}->{'html_basefile_path'} = $encoded_html_basefile_name;
my $tex4ht_file_path_name = File::Spec->catfile($tex4ht_out_dir,
$formats{$format}->{'basefile_name'});
my ($encoded_tex4ht_file_path_name, $tex4ht_path_encoding)
- = $self->encoded_file_name($tex4ht_file_path_name);
+ = $self->encoded_output_file_name($tex4ht_file_path_name);
$formats{$format}->{'counter'} = 0;
$formats{$format}->{'output_counter'} = 0;
@@ -257,7 +257,7 @@ sub tex4ht_convert($)
{
my $self = shift;
my ($encoded_tex4ht_out_dir, $tex4ht_out_dir_encoding)
- = $self->encoded_file_name($tex4ht_out_dir);
+ = $self->encoded_output_file_name($tex4ht_out_dir);
unless (chdir $encoded_tex4ht_out_dir) {
$self->document_warn($self,
sprintf(__("tex4ht.pm: chdir %s failed: %s"),
@@ -300,8 +300,7 @@ sub tex4ht_process_format($$) {
}
my $cmd = "$formats{$format}->{'exec'} $formats{$format}->{'basefile_name'}
$options";
- # FIXME do not know what would be better here
- my $encoding = $self->get_conf('MESSAGE_OUTPUT_ENCODING_NAME');
+ my $encoding = $self->get_conf('LOCALE_OUTPUT_ENCODING_NAME');
my $encoded_cmd;
if (defined($encoding)) {
$encoded_cmd = encode($encoding, $cmd);
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 2affebc7ac..484b959198 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -299,10 +299,19 @@ my $main_program_set_options = {
'PROGRAM' => $real_command_name,
'TEXINFO_DTD_VERSION' => $texinfo_dtd_version,
'DATA_INPUT_ENCODING_NAME' => $locale_encoding,
- 'MESSAGE_OUTPUT_ENCODING_NAME' => $locale_encoding,
- 'FILE_NAMES_ENCODING_NAME' => $file_name_encoding,
+ 'LOCALE_OUTPUT_ENCODING_NAME' => $locale_encoding,
+ 'LOCALE_INPUT_FILE_NAME_ENCODING' => $file_name_encoding,
+ 'LOCALE_OUTPUT_FILE_NAME_ENCODING' => $file_name_encoding,
};
+# use locale on Windows to set encoding of input file name as
+# system calls obey locale pages even if the filesystem uses
+# utf16 internally
+# FIXME better explanation?
+if ($^O eq 'MSWin32') {
+ $main_program_set_options->{'DOC_ENCODING_FOR_INPUT_FILE_NAME'} = 0;
+}
+
# defaults for options relevant in the main program. Also used as
# defaults for all the converters.
my $main_program_default_options = {
@@ -351,7 +360,7 @@ sub _decode_i18n_string($$)
sub _encode_message($)
{
my $text = shift;
- my $encoding = get_conf('MESSAGE_OUTPUT_ENCODING_NAME');
+ my $encoding = get_conf('LOCALE_OUTPUT_ENCODING_NAME');
if (defined($encoding)) {
return encode($encoding, $text);
} else {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Allow customization of input file name and output file name encoding,
Patrice Dumas <=