-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding/xml: Marshal/Escape allows invalid characters #4235
Labels
Milestone
Comments
I agree, it's heavy handed. However keep in mind this is actually a pretty serious bug, as many heavy-hitting XML framework/super-libraries are pedantic about checking that characters are valid. So the result of Marshal and Escape will cause errors in some other process down the line. The case I have is in a SAX parser in some Java process I don't control which abrubtly explodes when reading an attribute with a '\0' in it. At least Marshal could return an error, and a CheckedEscape or something to that effect could be used that allows returning an error. Another idea is to add a function that will check a string for valid codepoints, which could be used either before or after Escape, or whenever user code feels like it. |
1. Internally we will need the routine to know whether it is being called from something that can return errors. 2. Bad characters result in an error if we're returning errors; otherwise they turn into U+FFFD (best we can do). 3. Add EscapeText, a version of Escape that returns an error (issue #4112). |
This issue was closed by revision f74eb6d. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
The text was updated successfully, but these errors were encountered: