newdb: Fix dump and restore on non-ascii locales

Fix a bug in the new backend that broke the Check Library function on computers
with non-English locales. Fixes #1215819 [version 1.0 vérification de la bibliothèque](https://bugs.launchpad.net/calibre/+bug/1215819)

Upstream bug: https://code.google.com/p/apsw/issues/detail?id=142