Problem with character dec 8217 hex 2019 writing to file

When I am writing a string to an rtf-file, the character ’ which is dec 8217 or hex 2019 in the file is written as: ’

I tried to change the encoding of the string to UFT8 and WindowsANSI, but nothing worked. Any ideas?

Did the character change in the post here? That looks like ascii 39 to me… ’

If you really mean 8217, you can get it in there using \uc1\u8217*

It should be dec 39, but it is definitely 8217.

Changing to the string \uc1\u8217* as you suppose works! I wonder if this could be set somewhere in Xojo to write the RTF that way. Otherwise I will have to program workarounds for any character, that might cause problems…?

You have smart quotes turned on.
An utter pain when trying to write code that passes through smart text.
Code wants ' which is 39

Type 'hello' into Pages and you get Hello where the quotes curl inwards

Unfortunately, I don’t have control over what a user enters into the text…

Unfortunately, there are bugs in the Xojo RTF reader and writer which cause it to process Unicode characters incorrectly. It might be easier for you to create your own RTF writer code rather than trying to fix broken data.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.