Fix several errors in RTF text generation
Merge remote-tracking branch 'upstream/refactor-syntax_unicode' into refactor-syntax_unicode