[Libreoffice-commits] core.git: svl/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 23 10:50:01 UTC 2020


 svl/source/items/poolitem.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit fd9422febc384208558487bfe4a69ec89ab0ddca
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Sep 23 11:41:05 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Sep 23 12:49:26 2020 +0200

    Convert attribute value to UTF-8 when passing it to libxml2
    
    Using toUtf8, requiring the OUString to actually contain well-formed data, but
    which is likely OK for this test-code--only function, and is also what similar
    dumpAsXml functions e.g. in editeng/source/items/textitem.cxx already use.
    
    This appears to have been broken ever since the code's introduction in
    553f10c71a2cc92f5f5890e24948f5277e3d2758 "add dumpAsXml() to more pool items",
    and it would typically only have written the leading zero or one
    (depending on the architecture's endianness) characters.  (I ran across it on
    big-endian s390x, where CppunitTest_sd_tiledrendering
    SdTiledRenderingTest::testTdf104405 failed because of
    
    > Entity: line 2: parser error : Input is not proper UTF-8, indicate encoding !
    > Bytes: 0xCF 0x22 0x2F 0x3E
    > ation=""/><SfxPoolItem whichId="4017" typeName="13SvxBulletItem" presentation="%
    >                                                                                ^
    
    apparently reported from within libxml2.)
    
    Change-Id: I4b116d3be84098bd8b8a13b6937da70a1ee02c7f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103236
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Jenkins

diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index c5e09ddf9048..25f2720b547c 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -549,7 +549,8 @@ void SfxPoolItem::dumpAsXml(xmlTextWriterPtr pWriter) const
     OUString rText;
     IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
     if (GetPresentation( SfxItemPresentation::Complete, MapUnit::Map100thMM, MapUnit::Map100thMM, rText, aIntlWrapper))
-        xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(rText.getStr()));
+        xmlTextWriterWriteAttribute(
+            pWriter, BAD_CAST("presentation"), BAD_CAST(rText.toUtf8().getStr()));
     xmlTextWriterEndElement(pWriter);
 }
 


More information about the Libreoffice-commits mailing list