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

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