Python の base64.py はマニュアルででかでかと RFC 3548 をうたっているのですが、全然準拠できてないことに気づきました。 RFC 3548 には Implementations MUST reject the encoding if it contains characters outside the base alphabet when interpreting base encoded data, unless the specification referring to this document explicitly states otherwise. Such specifications may, as MIME does, instead state that characters outside the base encoding alphabet