Subject: | Document how to handle UTF-8 in bibtex files |
Date: | Sat, 18 Jun 2016 23:22:36 +0200 |
To: | bug-Text-BibTeX [...] rt.cpan.org |
From: | Elias Pipping <pipping.elias [...] icloud.com> |
Hi,
I’ve been using Text::BibTeX for quite a while now and it’s been serving me very well. Thank you for making that possible! Until earlier today I was using Text::BibTeX::purify_string to sanitise anything that was written to standard output. Now I wanted to print UTF-8 encoded strings, including some that were already in the bibtex file I was reading. It took me quite a while to get that right: Since Text::BibTeX::File::open() hands all its arguments over to IO::File and that class accepts a second argument “<:encoding(UTF-8)” to make it treat its input as UTF-8, I expected to be able to pass “<:encoding(UTF-8)” as the second argument to Text::BibTeX::File::open(). To do so was in fact possible, but did not seem to have any effect.
In the end, by looking at the source (in particular the test suite), I found out about Encode::decode_utf8, which allowed me to make things work. It would be nice if that was mentioned somewhere in the documentation of Text::BibTeX::File, assuming it’s the right solution.
Best, Elias