fix the decoding and the doctests for py3k