Line break character may be escaped by JS in VF Page
- Nov
- 13
- Posted by Lin
- Posted in APEX, Salesforce, Visualforce
The line break character may be changed, if it is sent from Visualforce Page with Ajax(Such as apex:commandLink and apex:actionfunction).
Let me show you a sample first.
Click [Compare By Submit] button, and the compare result is “true”.
Then click [Compare By Ajax] link,we will find the compare result is “false” and the “%0D”(CR) is lost in the new value which is sent by Javascript from Visualforce Page.
I am afraid the reason is that line break character “CRLF” will be escaped to “LF” by Javascript in Visualforce Page, when we use apex:commandLink or apex:actionfunction to send data to Apex.
Let me show you a sample first.
Sample Code
Visualforce Page
Apex Class
Results


