summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
authorAdam Kovacs <christo161@gmail.com>2019-05-17 11:30:26 +0200
committerLászló Németh <nemeth@numbertext.org>2019-05-18 00:07:55 +0200
commit1cbf0ee54519bf81d934609352e8a1a641d8a534 (patch)
tree8988ab365ea01095facba791b110aea97ccae2e3 /sw/source/filter
parent75ef0e41ea8a9096ac619356d2b837c5333b47e6 (diff)
tdf#125298 DOCX export: fix bookmark name truncation
The 40-character bookmark name truncation for MSO was applied on percent encoded Unicode letters, resulting shorter bookmark names, than needed (for example, only 6 letters instead of 40). This is a clean-up of the commit b9afb9959c31c3c57d0f2fe91107a92abfd82cdb "tdf#113483: DOCX: fix encoding of bookmarks with non-ASCII letters". Change-Id: I6fbcdc47c57ef228abcf29e0a68d3d8bb66c5661 Reviewed-on: https://gerrit.libreoffice.org/72456 Tested-by: László Németh <nemeth@numbertext.org> Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx8
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx2
2 files changed, 3 insertions, 7 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index d351101cf4a7..f47d539ddfb5 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1612,7 +1612,7 @@ void DocxAttributeOutput::DoWriteBookmarkTagStart(const OUString & bookmarkName)
{
m_pSerializer->singleElementNS(XML_w, XML_bookmarkStart,
FSNS(XML_w, XML_id), OString::number(m_nNextBookmarkId),
- FSNS(XML_w, XML_name), INetURLObject::decode(BookmarkToWord(bookmarkName), INetURLObject::DecodeMechanism::Unambiguous, RTL_TEXTENCODING_UTF8).toUtf8());
+ FSNS(XML_w, XML_name), BookmarkToWord(bookmarkName).toUtf8());
}
void DocxAttributeOutput::DoWriteBookmarkTagEnd(const OUString & bookmarkName)
@@ -1981,12 +1981,6 @@ void DocxAttributeOutput::CmdField_Impl( const SwTextNode* pNode, sal_Int32 nPos
sToken = sToken.replaceAll("NNNN", "dddd");
sToken = sToken.replaceAll("NN", "ddd");
}
- //tdf#113483: fix non-ascii characters inside instrText xml tags
- else if ( rInfos.eType == ww::eREF
- || rInfos.eType == ww::ePAGEREF )
- {
- sToken = INetURLObject::decode(sToken, INetURLObject::DecodeMechanism::Unambiguous, RTL_TEXTENCODING_UTF8);
- }
// Write the Field command
DoWriteCmd( sToken );
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 5ea8e4a5a7db..e5b8ece72dc5 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1157,6 +1157,8 @@ OUString BookmarkToWord(const OUString &rBookmark)
rBookmark.replace(' ', '_'), // Spaces are prohibited in bookmark name
INetURLObject::PART_REL_SEGMENT_EXTRA,
INetURLObject::EncodeMechanism::All, RTL_TEXTENCODING_ASCII_US));
+ // Unicode letters are allowed
+ sRet = INetURLObject::decode(sRet, INetURLObject::DecodeMechanism::Unambiguous, RTL_TEXTENCODING_UTF8);
return TruncateBookmark(sRet);
}