Fix encoding with libxml2 >= 2.12 push parser - #74
Open
lenz1111 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The enc parameter of htmlCreatePushParserCtxt() was deprecated and
is ignored in libxml2 >= 2.12.0. As a result, the HTML push parser defaults
to ISO-8859-1 encoding regardless of the value passed, causing UTF-8 multibyte
characters to be misinterpreted as Latin-1.
This breaks SOGo on systems with libxml2 >= 2.12 (e.g., RHEL 10):
Fix by calling xmlSwitchEncoding() after creating the push parser
context. This is the documented replacement for the deprecated enc
parameter per the libxml2 2.12.0 NEWS:
"Calling xmlSwitchEncoding from client code is now fully supported,
for example to override the encoding for the push parser."
The fix is backward-compatible with libxml2 2.9.x where it is a
harmless no-op since the encoding was already set via the enc
parameter.