The xml2sqlite.py script was failing to read XML files in encodings other than UTF-8, even when those files properly declared their encoding. The problem turned out to be that sys.stdin is treated as having whatever encoding locale.getpreferredencoding() returns -- on my computer, that's UTF-8. Passing sys.stdin.detach() to ET.parse instead of sys.stdin makes ET.parse treat the incoming stream as binary and figure out the encoding instead of assuming the encoding is UTF-8.