writerfilter/source/rtftok/rtfdocumentimpl.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 6eda6afc90eda8f0a424a5e91a2b00f06bbbb3c5
Author:     Oliver Specht <oliver.spe...@cib.de>
AuthorDate: Wed Jan 31 16:41:34 2024 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Feb 8 15:19:47 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>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 4db4a6352cce..188cec25b95a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3807,9 +3807,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);

Reply via email to