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

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