HomeClusterLabs Projects

Low: libcrmcommon: crm_xml_escape() shouldn't stop on Unicode characters

Description

Low: libcrmcommon: crm_xml_escape() shouldn't stop on Unicode characters

If anything, it should ignore them, so we continue instead of breaking
out of the loop. (Otherwise, it makes no sense to increment index.)

I'm not confident that this is a valid and comprehensive test for
Unicode characters. The libxml2 function xmlEncodeEntitiesReentrant()
uses a different test that looks more thorough. However, that function
has its own share of issues (for example, not escaping quote
characters), so I'm hesitant to trust it.

Meanwhile, a similar but distinct libxml2 function
xmlEncodeSpecialChars() does nothing special to Unicode characters,
assuming instead that it will "just work". See libxml2 source code
(currently in entities.c) if you're curious.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Feb 1 2024, 3:05 PM
Parents
rP0ce24ff08c9d: Refactor: libcrmcommon: Clarify replace_text() a bit and add doxygen
Branches
Unknown
Tags
Unknown