RTF in clarion report does not show text

Hi Jorge

After a bit of mucking around I think I have a solution for this.

The problem occurs where you have “Combining Diacritical Marks” in the text - these cause the problems when reporting.

see: Unicode Block “Combining Diacritical Marks”

There is more than one way to represent these characters - so the “trick” is to process your rtf text when saving to file (or some other time before printing) to translate these codes to something the print engine can handle.

I have done this using StringTheory based on your example rtf’s. I am translating the codes you have used (and some others) and stripping out the other modifiers that have not been translated. Those characters that are not translated will appear without the various accents. You can always add extra translations if you find you need them.

st StringTheory
x  long,Auto
y  long,Auto

  code
      st.setValue(clip(xxx:Description))  ! change to your field name
      st.replace('{{*\generator','{{\*\generator') 
      
      if st.findChars('\u769?')              ! https://www.compart.com/en/unicode/U+0301
        st.replace('A\u769?','\''c1')
        st.replace('E\u769?','\''c9')
        st.replace('I\u769?','\''cd')
        st.replace('O\u769?','\''d3')
        st.replace('U\u769?','\''da')
        st.replace('Y\u769?','\''dd')
        st.replace('a\u769?','\''e1')
        st.replace('e\u769?','\''e9')
        st.replace('i\u769?','\''ed')
        st.replace('o\u769?','\''f3')
        st.replace('u\u769?','\''fa')
        st.replace('y\u769?','\''fd')
      end
      
      if st.findChars('\u770?')                ! https://www.compart.com/en/unicode/U+0302
        st.replace('A\u770?','\''c2')
        st.replace('E\u770?','\''ca')
        st.replace('I\u770?','\''ce')
        st.replace('O\u770?','\''d4')
        st.replace('U\u770?','\''db')
        st.replace('a\u770?','\''e2')
        st.replace('e\u770?','\''ea')
        st.replace('i\u770?','\''ee')
        st.replace('o\u770?','\''f4')
        st.replace('u\u770?','\''fb')
      end
      
      if st.findChars('\u771?')                ! https://www.compart.com/en/unicode/U+0303
        st.replace('A\u771?','\''c3')
        st.replace('N\u771?','\''d1')
        st.replace('O\u771?','\''d5')
        st.replace('a\u771?','\''e3')
        st.replace('n\u771?','\''f1')
        st.replace('o\u771?','\''f5')
      end
      
      if st.findChars('\u807?')                ! https://www.compart.com/en/unicode/U+0327
        st.replace('C\u807?','\''c3')
        st.replace('c\u807?','\''e7')
      end
      
      ! remove/strip untranslated unicode modifiers  \uNNN?
      x = 1
      loop
        x = st.findChars('\u',x)
        if ~x then break.
        y = st.findChar('?',x+2)
        if ~y then break.
        if y <= x+6 and numeric(st.slice(x+2,y-1))
          st.RemoveFromPosition(x,y-x+1)
        else
          x += 2
        end
      end 
      
      xxx:Description = st.getValue()  ! update rtf field (change to use your field name)

anyway I hope that helps

cheers

Geoff R

#edit1. A couple of notes: Where I used

st.setValue(clip(xxx:Description))  ! change to your field name

I did it that way as I was loading from a memo field. If loading from a string field you are better to use:

st.setValue(myString, st:clip)  ! change to your field name

or perhaps you use st.LoadFile() if you are loading the rtf from a text file, then do the transformations then st.saveFile()

1 Like