function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lukas Razim 29Lukas Razim 29 

apex:outputText - missing characters

Hi All,

I need to generate letter (in paper form) for all campaign members (we use campaigns more like events, so those letters are supposed to be invitations). I added custom button on the campaign layout that should generate letters for all of them to print. I also added rich text field on campaign object where the text is stored (text would be same for all letters, just the beginning "Dear Mr. xxx" would differ and I have Oslovujeme__c custom field for this on contact object). See below code:

apex:page standardController="Campaign" showHeader="false" renderAs="pdf" applyBodyTag="false">
  <apex:repeat value="{!Campaign.CampaignMembers}" var="line">
    <div style="page-break-after:always;">
  <span style="font-family: Arial Unicode MS">
  {!line.Contact.Oslovujeme__c}, <br/><br/>
    <apex:outputText value="{!Campaign.Campaign_Letter_Rich__c}" escape="false"/>
    </span>
  </div>
    </apex:repeat>
</apex:page> 

The problem is.. that we have special characters in my language, such as ř,ě,ň, etc. These characters are generated correctly on pdf only for my custom field on contact Oslovujeme__c. But if any of these characters are in Campaign_Letter_Rich__c, they are missing on final pdf. Maybe it has something to do with "escape" attribute? If I dont use this escape=false, characters are rendered fine but with all the code around of course..
Check the sample output below in case I input same value "ěščřžýáíéúů" into both fields Oslovujeme__c and Campaign_Letter_Rich__c (assuming I have only one contact as campaign member). Some of the characters are missing then.. Can anyone help please? Many thanks

ěščřžýáíéúů,

šžýáíéú