Blame SOURCES/0001-Convert-attribute-value-to-UTF-8-when-passing-it-to-.patch

8228c6
From 78fd31b17931e1217d3b11fcbd13a41d79d99055 Mon Sep 17 00:00:00 2001
8228c6
From: Stephan Bergmann <sbergman@redhat.com>
8228c6
Date: Wed, 23 Sep 2020 11:41:05 +0200
8228c6
Subject: [PATCH] Convert attribute value to UTF-8 when passing it to libxml2
8228c6
8228c6
Using toUtf8, requiring the OUString to actually contain well-formed data, but
8228c6
which is likely OK for this test-code--only function, and is also what similar
8228c6
dumpAsXml functions e.g. in editeng/source/items/textitem.cxx already use.
8228c6
8228c6
This appears to have been broken ever since the code's introduction in
8228c6
553f10c71a2cc92f5f5890e24948f5277e3d2758 "add dumpAsXml() to more pool items",
8228c6
and it would typically only have written the leading zero or one
8228c6
(depending on the architecture's endianness) characters.  (I ran across it on
8228c6
big-endian s390x, where CppunitTest_sd_tiledrendering
8228c6
SdTiledRenderingTest::testTdf104405 failed because of
8228c6
8228c6
> Entity: line 2: parser error : Input is not proper UTF-8, indicate encoding !
8228c6
> Bytes: 0xCF 0x22 0x2F 0x3E
8228c6
> ation=""/>
8228c6
>                                                                                ^
8228c6
8228c6
apparently reported from within libxml2.)
8228c6
8228c6
Change-Id: I4b116d3be84098bd8b8a13b6937da70a1ee02c7f
8228c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103236
8228c6
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
8228c6
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
8228c6
Tested-by: Jenkins
8228c6
(cherry picked from commit fd9422febc384208558487bfe4a69ec89ab0ddca)
8228c6
---
8228c6
 svl/source/items/poolitem.cxx | 3 ++-
8228c6
 1 file changed, 2 insertions(+), 1 deletion(-)
8228c6
8228c6
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
8228c6
index ec37b68d3417..ad07a0b60b4b 100644
8228c6
--- a/svl/source/items/poolitem.cxx
8228c6
+++ b/svl/source/items/poolitem.cxx
8228c6
@@ -548,7 +548,8 @@ void SfxPoolItem::dumpAsXml(xmlTextWriterPtr pWriter) const
8228c6
     OUString rText;
8228c6
     IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
8228c6
     if (GetPresentation( SfxItemPresentation::Complete, MapUnit::Map100thMM, MapUnit::Map100thMM, rText, aIntlWrapper))
8228c6
-        xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(rText.getStr()));
8228c6
+        xmlTextWriterWriteAttribute(
8228c6
+            pWriter, BAD_CAST("presentation"), BAD_CAST(rText.toUtf8().getStr()));
8228c6
     xmlTextWriterEndElement(pWriter);
8228c6
 }
8228c6
 
8228c6
-- 
8228c6
2.33.1
8228c6