crash with helpful errors on invalid encodings