summaryrefslogtreecommitdiff
path: root/support/latexindent/LatexIndent/FileExtension.pm
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-04-12 03:01:14 +0000
committerNorbert Preining <norbert@preining.info>2023-04-12 03:01:14 +0000
commit45c7bac9080d91b53c686e776fc6217d7f139b86 (patch)
tree9dd0ad4713ddbc97580545398e8a3c84ac52bf49 /support/latexindent/LatexIndent/FileExtension.pm
parente6c62f5e4d4a4d5ab654dad1652e83a5a4a42891 (diff)
CTAN sync 202304120301
Diffstat (limited to 'support/latexindent/LatexIndent/FileExtension.pm')
-rw-r--r--support/latexindent/LatexIndent/FileExtension.pm13
1 files changed, 10 insertions, 3 deletions
diff --git a/support/latexindent/LatexIndent/FileExtension.pm b/support/latexindent/LatexIndent/FileExtension.pm
index b0f49f246d..b61ffc1bb4 100644
--- a/support/latexindent/LatexIndent/FileExtension.pm
+++ b/support/latexindent/LatexIndent/FileExtension.pm
@@ -21,6 +21,7 @@ use PerlIO::encoding;
use open ':std', ':encoding(UTF-8)';
use File::Basename; # to get the filename and directory path
use Exporter qw/import/;
+use Encode qw/decode/;
use LatexIndent::GetYamlSettings qw/%mainSettings/;
use LatexIndent::Switches qw/%switches $is_check_switch_active/;
use LatexIndent::LogFile qw/$logger/;
@@ -114,7 +115,12 @@ sub file_extension_check {
$logger->info("*-o switch active: output file check");
- ${$self}{outputToFile} = $switches{outputToFile};
+ # diacritics in file names (highlighted in https://github.com/cmhughes/latexindent.pl/pull/439)
+ #
+ # note, related:
+ #
+ # git config --add core.quotePath false
+ ${$self}{outputToFile} = decode( "utf-8", $switches{outputToFile} );
if ( $fileName eq "-" and $switches{outputToFile} =~ m/^\+/ ) {
$logger->info("STDIN input mode active, -o switch is removing all + symbols");
@@ -124,7 +130,7 @@ sub file_extension_check {
# the -o file name might begin with a + symbol
if ( $switches{outputToFile} =~ m/^\+(.*)/ and $1 ne "+" ) {
$logger->info("-o switch called with + symbol at the beginning: ${$self}{outputToFile}");
- ${$self}{outputToFile} = ${$self}{baseName} . $1;
+ ${$self}{outputToFile} = decode( "utf-8", ${$self}{baseName} . $1 );
$logger->info("output file is now: ${$self}{outputToFile}");
}
@@ -137,7 +143,8 @@ sub file_extension_check {
# if there is no extension, then add the extension from the file to be operated upon
if ( !$ext ) {
- $logger->info("-o switch called with file name without extension: $switches{outputToFile}");
+ $logger->info(
+ "-o switch called with file name without extension: " . decode( "utf-8", $switches{outputToFile} ) );
${$self}{outputToFile} = $name . ( $name =~ m/\.\z/ ? q() : "." ) . $strippedFileExtension;
$logger->info(
"Updated to ${$self}{outputToFile} as the file extension of the input file is $strippedFileExtension");