diff options
author | Norbert Preining <norbert@preining.info> | 2023-04-08 03:01:13 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-04-08 03:01:13 +0000 |
commit | 24c6de40a2869f5b6c213c2cf69e597f885f2b19 (patch) | |
tree | 5225200910d14cb8b177fad2192b492f3b254e5c /support/latexindent/LatexIndent/Document.pm | |
parent | bd96eb3748479a2feb0e8a0ef06203de92766953 (diff) |
CTAN sync 202304080301
Diffstat (limited to 'support/latexindent/LatexIndent/Document.pm')
-rw-r--r-- | support/latexindent/LatexIndent/Document.pm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/support/latexindent/LatexIndent/Document.pm b/support/latexindent/LatexIndent/Document.pm index d365388679..4a99721a34 100644 --- a/support/latexindent/LatexIndent/Document.pm +++ b/support/latexindent/LatexIndent/Document.pm @@ -20,6 +20,7 @@ use warnings; use Data::Dumper; use File::Basename; # to get the filename and directory path use open ':std', ':encoding(UTF-8)'; +use Encode qw/decode/; # gain access to subroutines in the following modules use LatexIndent::Switches @@ -97,7 +98,7 @@ sub latexindent { # one-time operations $self->store_switches; - ${$self}{fileName} = $fileNames[0]; + ${$self}{fileName} = decode( "utf-8", $fileNames[0] ); $self->process_switches( \@fileNames ); $self->yaml_read_settings; @@ -228,13 +229,26 @@ sub output_indented_text { # if -overwrite is active then output to original fileName if ( ${$self}{overwrite} ) { + + # diacritics in file names (highlighted in https://github.com/cmhughes/latexindent.pl/pull/439) + ${$self}{fileName} = decode( "utf-8", ${$self}{fileName} ); + $logger->info("Overwriting file ${$self}{fileName}"); open( OUTPUTFILE, ">", ${$self}{fileName} ); print OUTPUTFILE ${$self}{body}; close(OUTPUTFILE); } elsif ( $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", ${$self}{outputToFile} ); + $logger->info("Outputting to file ${$self}{outputToFile}"); + open( OUTPUTFILE, ">", ${$self}{outputToFile} ); print OUTPUTFILE ${$self}{body}; close(OUTPUTFILE); |