Skip to content

Fix encoding with libxml2 >= 2.12 push parser - #74

Open
lenz1111 wants to merge 1 commit into
Alinto:masterfrom
lenz1111:libxml2_2_12_fix
Open

Fix encoding with libxml2 >= 2.12 push parser#74
lenz1111 wants to merge 1 commit into
Alinto:masterfrom
lenz1111:libxml2_2_12_fix

Conversation

@lenz1111

@lenz1111 lenz1111 commented Aug 4, 2026

Copy link
Copy Markdown

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):

  • Viewing HTML emails with non-ASCII characters shows garbled text
  • Plain text alternative parts of sent emails are double-encoded

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant