Website bug

David Cantrell david at cantrell.org.uk
Mon Jan 7 15:21:24 GMT 2008


On Sat, Jan 05, 2008 at 06:30:46PM +0000, Simon Wistow wrote:
> On Fri, Jan 04, 2008 at 02:55:52PM +0000, Dave Cantrell said:
> > There's a bug in the magic that converts XML into HTML for the website -
> > if a book has an ISBN-13 (and all new books should now) then the Amazon
> > URL used to linked them is broken cos ASINs are still only 10 digits.
> Is there a mapping from ISBN-13 to ASIN? If not I'll hack the logic to 
> just not link.

For ISBN-13s beginning 978 you can chop off the leading 978 and
re-calculate the checksum digit to turn it into the corresponding
ISBN-10.  But that won't work for the 979 prefix.  Not that there are
any of those in the wild yet, but ...

For extra spicy fun, you can't just blindly chop off a leading 978, as
there are ISBN-10s that begin 978 (and corresponding ISBN-13s that begin
978978).  Check the length first.

-- 
David Cantrell | A machine for turning tea into grumpiness

  All principles of gravity are negated by fear
                                            -- Cartoon Law V


More information about the london.pm mailing list