diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2021-06-11 21:40:35 +0200 |
---|---|---|
committer | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2021-06-18 12:10:17 +0200 |
commit | d50501d1b4c015232c31c75a16b96143d43f7a3f (patch) | |
tree | dc75a9721c82dc86d62629d6a806c97ae5087ca7 | |
parent | 04cd6749177f886f382e8bcd026f95112ee22473 (diff) |
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@yahoo.de>
-rw-r--r-- | oox/source/core/xmlfilterbase.cxx | 3 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf127864.docx | bin | 0 -> 4726 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport2.cxx | 11 |
3 files changed, 13 insertions, 1 deletions
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 Binary files differnew file mode 100644 index 000000000000..a9e59d933186 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf127864.docx 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); |