Biber::Utils(3pm)

๐Ÿ’– Biber::Utils โ€” the NAME bit ๐Ÿ’–

okay so Biber::Utils is literally just a grab-bag of utility subs that Biber uses everywhere. bestie, it's the junk drawer but make it โœจorganizedโœจ. This is the User Contributed Perl Documentation for it, Biber::Utils(3pm).


๐ŸŽ€ EXPORT ๐ŸŽ€

every single function here is exported by default. no imports needed, no cap. they just show up. ๐Ÿ’…


๐ŸŒธ FUNCTIONS ๐ŸŒธ

globU1

basically glob, except it takes a Unicode string as its argument. that's it. that's the whole vibe. ๐Ÿฆ‹

globU

also like glob, but with two little twists: (1) it takes a Unicode string as its argument, and (2) it tries NFC and NFD variants of the pattern, which gives you a useful approximation of a normalization-insensitive glob. it works when filenames are known to be pure NFC or pure NFD. ๐Ÿซถ

this covers, among others:

  • Apple's HFS+ file system, where filenames are coerced to NFD, and filenames \addbibresource[glob] are NFC (which is natural for keyboard entry, with typical keyboard layouts).
  • similar situation on APFS where some (not all) programs made files with NFD names even when the user types in NFC.
  • related issues when transfer between OSs changes NF of filenames but not of contents of files, e.g., .tex files.

glob_data_file

expands a data file glob to a list of filenames. ๐Ÿ’ซ

slurp_switchr

uses different read encoding/slurp interfaces for Windows because of its horrible legacy codepage system. windows, bestie. ๐Ÿ˜ญ

slurp_switchw

uses different write encoding/slurp interfaces for Windows, again because of that horrible legacy codepage system. same energy, write edition. ๐Ÿ’€

locate_data_file

searches for a data file by:

  • the exact path, if the filename is absolute
  • in the input_directory, if defined
  • in the output_directory, if defined
  • relative to the current directory
  • in the same directory as the control file
  • using kpsewhich, if available

it also checks existence of NFC/NFD file variants and returns the correct one, and it accounts for windows file encodings. ๐ŸŒˆ

check_empty

wrapper around an empty check, there specifically to deal with Win32 Unicode filenames. โœจ

check_exists

wrapper around an exists check, also for Win32 Unicode filenames. ๐Ÿ‘‘

biber_warn

wrapper around various warnings bits and pieces. adds the warning to the list of .bbl warnings and to the master list of warnings. ๐ŸŽ€

biber_error

wrapper around error logging. heads up: it forces an exit. dramatic but necessary. ๐Ÿšจ

makenamesid

given a Biber::Names object, return an underscore-normalised concatenation of all of the full name strings. ๐Ÿ’œ

makenameid

given a Biber::Name object, return an underscore-normalised concatenation of the full name strings. same idea, singular. ๐Ÿฆ‹

latex_recode_output

tries to convert UTF-8 to TeX macros in the passed string. ๐Ÿ”ฅ

strip_noinit

removes elements which are not to be considered during initials generation in names. โœ‚๏ธ

strip_nosort

removes elements which are not to be used in sorting a name, from a string. ๐Ÿงน

strip_nonamestring

removes elements which are not to be used in certain name-related operations like:

  • fullhash generation
  • uniquename generation

โ€ฆfrom a name. ๐Ÿซง

normalise_string_label

removes some things from a string for label generation. don't strip \p{Dash}, because that's needed to process compound names or label generation. ๐ŸŒธ

normalise_string_sort

removes LaTeX macros, and all punctuation, symbols, separators, as well as leading and trailing whitespace, for sorting strings. control chars don't need to be stripped because they are completely ignorable in DUCET. ๐Ÿ’…

normalise_string_bblxml

some string normalisation for bblxml output. ๐ŸŽ€

normalise_string

removes LaTeX macros, and all punctuation, symbols, separators and control characters, as well as leading and trailing whitespace, for sorting strings. it only decodes LaTeX character macros into Unicode if output is UTF-8. ๐ŸŒˆ

normalise_string_common

the common bit for normalisation. shared plumbing, iconic. ๐Ÿ› ๏ธ

normalise_string_hash

normalises strings used for hashes. it collapses LaTeX macros into a vestige so that hashes are unique between things like:

Smith
{\v S}mith

we replace macros like this to preserve their vestiges:

\v S -> v:
\" -> 34:

normalise_string_underscore

like normalise_string, but it also substitutes ~ and whitespace with underscore. ๐Ÿซถ

escape_label

escapes a few special characters which might be used in labels. ๐Ÿ›ก๏ธ

unescape_label

unscapes (yes, unscapes, that's the word on the page ๐Ÿ˜ญ) a few special characters which might be used in a label but which need sorting without escapes. ๐Ÿ”“

reduce_array

reduce_array(\@a, \@b) returns all elements in @a that are not in @b. ๐Ÿ’ซ

remove_outer

removes surrounding curly brackets:

'{string}' -> 'string'

but not:

'{string} {string}' -> 'string} {string'

return value is (boolean if stripped, string). โญ

has_outer

returns (boolean if surrounded in braces. ๐ŸŽ€

add_outer

adds surrounding curly brackets:

'string' -> '{string}'

ucinit

upper case of initial letters in a string. ๐Ÿ” 

is_undef

checks for undefness of arbitrary things, including composite method chain calls which don't reliably work with defined() (see perldoc for defined()). this works because we are just testing the value passed to this sub. so, for example, this is randomly unreliable even if the resulting value of the arg to defined() is "undef":

defined($thing->method($arg)->method)

whereas:

is_undef($thing->method($arg)->method)

works, since we only test the return value of all the methods with defined(). ๐Ÿ’€

is_def

checks for definedness in the same way as is_undef(). โœ…

is_undef_or_null

checks for undef or nullness (see is_undef() above). ๐Ÿค”

is_def_and_notnull

checks for def and unnullness (see is_undef() above). ๐Ÿซถ

is_def_and_null

checks for def and nullness (see is_undef() above). ๐ŸŽ€

is_null

checks for nullness. ๐Ÿ•ณ๏ธ

is_notnull

checks for notnullness. ๐Ÿ’–

is_notnull_scalar

checks for notnullness of a scalar. ๐Ÿฆ‹

is_notnull_array

checks for notnullness of an array (passed by ref). ๐ŸŒธ

is_notnull_hash

checks for notnullness of a hash (passed by ref). ๐ŸŒˆ

is_notnull_object

checks for notnullness of an object (passed by ref). ๐Ÿ‘‘

stringify_hash

turns a hash into a string of keys and values. ๐Ÿ”ค

normalise_utf8

normalises any UTF-8 encoding string immediately to exactly what we want โ€” we want the strict perl utf8 "UTF-8". ๐Ÿ’…

inits

we turn the initials into an array so we can be flexible with them later. the tie here is used only so we know what to split on. we don't want to make any typesetting decisions in Biber, like what to use to join initials, so on output to the .bbl, we only use BibLaTeX macros. ๐ŸŽ€

join_name

replaces all join typesetting elements in a name part (space, ties) with BibLaTeX macros, so that typesetting decisions are made in BibLaTeX, not hard-coded in Biber. ๐Ÿซถ

filter_entry_options

processes any per_entry option transformations which are necessary on output. ๐Ÿงš

imatch

does an interpolating (neg)match using a match RE and a string passed in as variables. it uses /g on matches so that $1, $2 etc. can be populated from repeated matches of the same capture group as well as different groups. ๐Ÿ”

ireplace

does a relatively safe interpolating match/replace using a match RE, replacement RE and string passed in as variables. ๐Ÿ› ๏ธ

validate_biber_xml

validates a biber/biblatex XML metadata file against an RNG XML schema. โœ…

map_boolean

converts booleans between strings and numbers, because the standard XML "boolean" datatype considers "true" and "1" the same etc. ๐Ÿ™ƒ

process_entry_options

sets per-entry options. โš™๏ธ

merge_entry_options

merges entry options, dealing with conflicts. ๐Ÿค

expand_option_input

expands options such as meta-options coming from biblatex. ๐Ÿ’ฅ

parse_date_range

parses an ISO8601 date range. ๐Ÿ“…

parse_date_unspecified

parses an ISO8601-2:2016 4.3 unspecified format into a date range. returns the range plus a specification of the granularity of unspecified. ๐Ÿ”Ž

parse_date_start

convenience wrapper. ๐ŸŽ

parse_date_end

convenience wrapper. ๐ŸŽ

parse_date

parses iso8601-2 dates. ๐Ÿ—“๏ธ

date_monthday

forces month/day to ISO8601-2:2016 format with a leading zero. 07 not 7, bestie. โœจ

biber_decode_utf8

performs NFD form conversion as well as UTF-8 conversion. it's used to normalize bibtex input because the T::B interface doesn't allow a neat whole-file slurping. ๐Ÿ˜ค

out

outputs to target. outputs NFC UTF-8 if output is UTF-8. ๐Ÿ“ค

process_comment

fixes up some problems with comments after being processed by btparse. ๐Ÿฉน

locale2bcp47

maps babel/polyglossia language options to a sensible CLDR (bcp47) locale default. returns the input string if there is no mapping. ๐ŸŒ

bcp472locale

maps a CLDR (bcp47) locale to a babel/polyglossia locale. returns the input string if there is no mapping. ๐Ÿ—บ๏ธ

rangelen

calculates the length of a range field. range fields are an array ref of two-element array refs [range_start, range_end]. range_end can be empty for an open-ended range, or undef. it deals with Unicode and ASCII roman numerals via the magic of Unicode NFKD form. ๐Ÿ”ข

m-n -> [m, n]
m   -> [m, undef]
m-  -> [m, '']
-n  -> ['', n]
-   -> ['', undef]

match_indices

returns an array ref of array refs of matches and start indices of matches, for a provided array of compiled regexps into a string. ๐ŸŽฏ

parse_range

parses a range of values into a two-value array ref. ranges with no starting value default to "1". ranges can be open-ended and it's up to surrounding code to interpret this. ranges can be single figures, which is shorthand for 1-x. ๐Ÿ“

strip_annotation

removes the annotation marker from a field name. โœ‚๏ธ

parse_range_alt

parses a range of values into a two-value array ref. either start or end can be undef and it's up to surrounding code to interpret this. ๐Ÿซง

maploopreplace

replaces loop markers with values. ๐Ÿ”

get_transliterator

gets a ref to a transliterator for the given from/to. we're abstracting it this way because it's not clear what the future of the transliteration library is โ€” we want to be able to switch. ๐Ÿ”ฎ

call_transliterator

runs a transliterator on passed text. it hides the call semantics of the transliterator so we can switch engines in the future. ๐Ÿ”„


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Philip Kime <philip at kime.org.uk> โ€” the icon himself. ๐Ÿ’œ


๐Ÿ› BUGS ๐Ÿ›

please report any bugs or feature requests on our Github tracker at <https://github.com/plk/biber/issues>. do it, bestie, they actually want to hear it. ๐Ÿ™ˆ


Copyright 2012-2026 Philip Kime, all rights reserved.

this module is free software. you can redistribute it and/or modify it under the terms of the Artistic License 2.0. ๐ŸŽจ

this program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. no promises, fr fr. ๐Ÿ˜ญ


and that's the whole thing! ๐ŸŒŸ this was Biber::Utils(3pm) from the User Contributed Perl Documentation, running on perl v5.42.3, dated 2026-08-14. slay, go normalise some strings. ๐Ÿ’…โœจ๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from