Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
x/text/encoding: Go's reuse of character sets causes incorrect decoding of invalid input #29535
What version of Go are you using (
Interesting, but US-ASCII and Windows1252 are different charactersets (windows 1252 is a superset).
Other languages like Java allow users to differentiate between these character sets. For decoding legacy text, it is not ideal to use a superset characterset like windows1252, because invalid characters which are not expressible in the subset character set can be inserted into the result if the user's text is invalid. This requires developers to implement workarounds to ensure invalid text is not contained in the result.