plk/biber

binmode somehow doesn't work

Closed this issue · 4 comments

Hi,

I'm new to biber and not know much about programming. The last time I use biber it was OK, but now I got this error message when running it.

Process started: biber.exe "alter-bib"

Can't call method "binmode" on an undefined value at C:\Users\PC\AppData\Local\Temp\par-5043\cache-06e9a38c53673918a3d3c69be7b4e502344f366b\de273e16.pm line 113.
INFO - This is Biber 2.16
INFO - Logfile is 'alter-bib.blg'
Process exited with error(s)

When I check the file and the line it refers to, I think it is this line
$fh->binmode(":encoding($encoding)");

This is the things around that line:
sub slurp_switchr {
my ($filename, $encoding) = @_;
my $slurp;
$encoding //= 'UTF-8';
if ($^O =~ /Win/ and not Biber::Config->getoption('winunicode')) {
require Win32::Unicode::File;
my $fh = Win32::Unicode::File->new('<', NFC($filename));
$fh->binmode(":encoding($encoding)");
# 100MB block size as the loop over the default 1MB block size seems to fail for
# files > 1Mb
$slurp = $fh->slurp({blk_size => 10241024100});
$fh->close;
}
else {
$slurp = File::Slurper::read_text($filename, $encoding);
}
return $slurp;
}

Do you know what is the problem and how to fix it?
I saw an earlier post on binmode having issue with non-Unicode characters, but my bib file has no non-Unicode that I'm aware of, nor does the file name. My Biblatex package is also 3.16 which I think is compatible with my Biber version. Here is what I have in my bib file
@thesis{kimoto17_arta,
author = {Yukinori Kimoto},
title = {A grammar of Arta: a Philipine Negrito language},
type = {Ph.D.},
institution = {Kyoto University},
date = {2017},
location = {Kyoto, Japan},
}
@thesis{brickell14_tondano,
author = {Timothy Brickell},
title = {A grammatical description of the Tondano (Toundano) language},
type = {Ph.D.},
institution = {La Trobe University},
date = {2014},
location = {Victoria, Australia},
}
@thesis{meng18_tulil,
author = {Chenxi Meng},
title = {A grammar of Tulil},
type = {Ph.D.},
institution = {La Trobe University},
date = {2018},
location = {Victoria, Australia},
}
@book{morey10_turung,
author = {Stephen Morey},
title = {Turung: a variety of Singpho language spoken in Assam},
date = {2010},
series = {Pacific Linguistics},
number = {614},
publisher = {Australian National University},
location = {Canberra},
}
@book{forker20_sanzhidargwa,
author = {Diana Forker},
title = {A grammar of Sanzhi Dargwa},
date = {2020},
series = {Languages of the Caucasus},
number = {2},
publisher = {Language Science Press},
location = {Berlin},
}
@thesis{schnell11_veraa,
author = {Stefan Schnell},
title = {A grammar of Vera'a},
type = {Ph.D.},
institution = {Kiel University},
date = {2011},
location = {Germany},
}
@thesis{thieberger04_efate,
author = {Nicholas Thieberger},
title = {Topics in the grammar and documentation of South Efate, an Oceanic language of Central Vanuatu},
type = {Ph.D.},
institution = {University of Melbourne},
date = {2004},
location ={Melbourne},
}

Thank you in advance.

plk commented

I'm assuming you are using Windows 10 version 1803+? If so, can you try calling biber with the --winunicode option and see what happens?

Yes, It works normally now.
Thank you

@plk and @trancl I am using Texstudio and MikTex, how can I configure my Texstudio to use that option?

plk commented

I use Emacs for everything so I'm not sure but there will be a way to specify the command line in those tools - I would ask on tex.stackexchange.com and someone will tell you.