[Libreoffice-commits] core.git: oox/source sw/qa

Andreas Heinisch (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 18 10:15:38 UTC 2021


 oox/source/core/xmlfilterbase.cxx            |    3 ++-
 sw/qa/extras/ooxmlexport/data/tdf127864.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx    |   11 +++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit d50501d1b4c015232c31c75a16b96143d43f7a3f
Author:     Andreas Heinisch <andreas.heinisch at yahoo.de>
AuthorDate: Fri Jun 11 21:40:35 2021 +0200
Commit:     Andreas Heinisch <andreas.heinisch at yahoo.de>
CommitDate: Fri Jun 18 12:10:17 2021 +0200

    tdf#127864 - Export custom document properties using utf8 text encoding
    
    Change-Id: Iaca1f9251e87ec199b55888c1ab6421a654d1f9f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117071
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heinisch at yahoo.de>

diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index a8532d206d31..307949ae4076 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -858,7 +858,8 @@ writeCustomProperties( XmlFilterBase& rSelf, const Reference< XDocumentPropertie
     {
         if ( !rProp.Name.isEmpty() )
         {
-            OString aName = OUStringToOString( rProp.Name, RTL_TEXTENCODING_ASCII_US );
+            // tdf#127864 - export custom document properties using utf8 text encoding
+            OString aName = OUStringToOString(rProp.Name, RTL_TEXTENCODING_UTF8);
             // Skip storing these values in Custom Properties as it will be stored in Core/Extended Properties
             if (( aName == "OOXMLCorePropertyCategory" ) || // stored in cp:category
                 ( aName == "OOXMLCorePropertyContentStatus" ) || // stored in cp:contentStatus
diff --git a/sw/qa/extras/ooxmlexport/data/tdf127864.docx b/sw/qa/extras/ooxmlexport/data/tdf127864.docx
new file mode 100644
index 000000000000..a9e59d933186
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf127864.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index aa1378398992..aaecebc5cf94 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -155,6 +155,17 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCustomProperties, "custom-properties.doc
     assertXPathContent(pXmlDoc, "/cp:coreProperties/dc:identifier", "zzzzidentifier");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testUTF8CustomProperties, "tdf127864.docx")
+{
+    uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(
+        mxComponent, uno::UNO_QUERY);
+    uno::Reference<document::XDocumentProperties> xDocumentProperties
+        = xDocumentPropertiesSupplier->getDocumentProperties();
+    uno::Reference<beans::XPropertySet> xPropertySet(
+        xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString(u"первый"), getProperty<OUString>(xPropertySet, u"первый"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testZoom, "zoom.docx")
 {
     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);


More information about the Libreoffice-commits mailing list