writerfilter/source/rtftok/rtfdocumentimpl.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
New commits: commit d37be1f9581a8a02c10c7bd88e83c74e2b46bc75 Author: Oliver Specht <oliver.spe...@cib.de> AuthorDate: Wed Jan 31 16:41:34 2024 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Fri Feb 9 08:36:08 2024 +0100 tdf#159478 read field comment in default encoding If a symbol font is applied inside a field the command string was wrongly converted as symbol text. This is fixed by using a default RTL_TEXTENCODING_MS_1252 encoding. Change-Id: I11326ef3c79d6d74c720a2b4ac4987ee6716d912 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162844 Tested-by: Jenkins Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163120 diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 2c851b95a2fb..48124554481d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3805,9 +3805,11 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex) if (bHex && !m_aHexBuffer.isEmpty()) { rtl_TextEncoding nEncoding = m_aStates.top().getCurrentEncoding(); - if ((m_aStates.top().getDestination() == Destination::FONTENTRY - || m_aStates.top().getDestination() == Destination::FIELDINSTRUCTION) - && m_aStates.top().getCurrentEncoding() == RTL_TEXTENCODING_SYMBOL) + if (nEncoding == RTL_TEXTENCODING_SYMBOL + && (m_aStates.top().getDestination() == Destination::FONTENTRY + || (m_aStates.size() > 1 + && m_aStates[m_aStates.size() - 2].getDestination() + == Destination::FIELDINSTRUCTION))) nEncoding = RTL_TEXTENCODING_MS_1252; OUString aString = OStringToOUString(m_aHexBuffer, nEncoding); m_aHexBuffer.setLength(0);