Raise syntax-error
correctly on invalid encodings
#7553
Merged
syntax-error
correctly on invalid encodings
#7553