Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:plk/biber into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
plk committed Nov 7, 2024
2 parents c77ae67 + 1db3b6c commit c446038
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
10 changes: 7 additions & 3 deletions lib/Biber/CodePage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use strict;
use warnings;
use parent qw(Exporter);
our @EXPORT = qw( decode_CS_system encode_CS_system get_CS_system
is_Unicode_system
set_CP_Win_console set_CS_defaults set_STD_encodings );
our @EXPORT_OK = qw( get_CS_log string_analysis );

Expand Down Expand Up @@ -92,6 +93,12 @@ sub get_CS_log() {

#--------------------------

sub is_Unicode_system() {
return (uc($CS_system) eq 'UTF-8') || (uc($CS_system) eq 'CP65001');
}

#--------------------------

sub set_STD_encodings($) {
# Set coding scheme for STDOUT, STDERR & STDIN.
my $CS = shift;
Expand Down Expand Up @@ -249,7 +256,4 @@ END {
# Don't worry about what to do with STDOUT, etc; it should be unimportant from here.
}




1;
17 changes: 5 additions & 12 deletions lib/Biber/Utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,8 @@ sub slurp_switchr {
my ($filename, $encoding) = @_;
my $slurp;
$encoding //= 'UTF-8';
if ($^O =~ /Win/ and not Biber::Config->getoption('winunicode')) {
if ($^O =~ /Win/ and not is_Unicode_system() ) {
require Win32::Unicode::File;
# JCC ?? Removed NFC
my $fh = Win32::Unicode::File->new('<', $filename);
$fh->binmode(":encoding($encoding)");
# 100MB block size as the loop over the default 1MB block size seems to fail for
Expand All @@ -196,17 +195,15 @@ sub slurp_switchr {

sub slurp_switchw {
my ($filename, $string) = @_;
if ($^O =~ /Win/ and not Biber::Config->getoption('winunicode')) {
if ($^O =~ /Win/ and not is_Unicode_system() ) {
require Win32::Unicode::File;
# JCC ?? Removed NFC
my $fh = Win32::Unicode::File->new('>', $filename);
$fh->binmode(':encoding(UTF-8)');
$fh->write($string);
$fh->flush;
$fh->close;
}
else {
# JCC ?? Removed NFC
File::Slurper::write_text($filename, $string);
}
return;
Expand Down Expand Up @@ -394,9 +391,8 @@ sub locate_data_file {

sub file_exist_check {
my $filename = shift;
if ($^O =~ /Win/ and not Biber::Config->getoption('winunicode')) {
if ($^O =~ /Win/ and not is_Unicode_system() ) {
require Win32::Unicode::File;
# JCC ?? Add test without NF mapped filename.
if (Win32::Unicode::File::statW($filename)) {
return $filename;
}
Expand All @@ -408,7 +404,6 @@ sub file_exist_check {
}
}
else {
# JCC ?? Add test without NF mapped filename.
if (-e "$filename") {
return $filename;
}
Expand All @@ -431,9 +426,8 @@ sub file_exist_check {

sub check_empty {
my $filename = shift;
if ($^O =~ /Win/ and not Biber::Config->getoption('winunicode')) {
if ($^O =~ /Win/ and not is_Unicode_system() ) {
require Win32::Unicode::File;
# JCC ?? Remove NFC
return (Win32::Unicode::File::file_size($filename)) ? 1 : 0;
}
else {
Expand All @@ -449,9 +443,8 @@ sub check_empty {

sub check_exists {
my $filename = shift;
if ($^O =~ /Win/ and not Biber::Config->getoption('winunicode')) {
if ($^O =~ /Win/ and not is_Unicode_system() ) {
require Win32::Unicode::File;
# JCC ?? Remove NFC
return Win32::Unicode::File::statW($filename) ? 1 : 0;
}
else {
Expand Down
Binary file modified testfiles/Unicode-tests-preserved-NF.zip
Binary file not shown.

0 comments on commit c446038

Please sign in to comment.