At work today I wrote a conversion tool to translate 10 digit ISBNs into 13 digit ISBNs. Jessica Kingsley Publishers have given me permission to share it with the world here.
I first wrote about ISBN-13 back in January 2003 and now I’m in a company that needs to contend with it.
The idea is to make the ISBN longer to allow for more of them. The clever bit about the initial move is that the ISBN-13s match the barcode EAMs, so the conversion work is relatively trivial. Having said that, I couldn’t find any code like the code below, when I went looking this week. I hope you find it useful.
You can read more online at the following places
- ISO ISBN working group website (including FAQs) and containing Draft Guidelines for the Implementation of ISBN-13 [pdf] (this includes the formula to generate the check digit)
- ISBN website, most usefully includes the ISBN User Manual [pdf] (including the algorithm for translating ISBN-10 to ISBN-13, aka Bookland EAN) and the page on the revision. Also has Guidelines for the Implementation of 13-Digit ISBNs [pdf]
- Book Industry Communication – pulls together links about ISBN-13, Onix etc.
Here’s the code.
Aha. Thank you very much for that. I suspected I was missing some obvious stuff (apart from the slightly scrappy code).
The hyphenate_isbn13 is far from complete. Most contries have 2+ numbers as country code and the publisher ranges vary within for each country.
See the country/publisher range list here: http://www.isbn-international.org/en/identifiers/List-of-Ranges.pdf
You will find a fully functional free converter here:
http://www.isbn-international.org/converter/converter.html