Line break character may be escaped by JS in VF Page

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.

Sample Code

Visualforce Page

Apex Class

Results

Salesforce   Developer Edition Click [Compare By Submit] button, and the compare result is “true”. Salesforce   Developer Edition2 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. Salesforce   Developer Edition3 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.

Related Post

Salesforce Mass Editor (Chrome Extension) – ... This's my second Chrome Extension (First one is HERE) this year, named "Salesforce Mass Editor" and it supports for doing the below things : ・Makes any Salesforce list view to be a powerful mass editor. ・Mass insert, mass clone, mass update, mass delete, ALL-IN-ONE. ・Export record data to CSV fi...
Setup an awesome Salesforce developer environment ... Why Sublime Text 3 ? I've been working with Force.com for about 2 years, and always using Eclipse+Force.com IDE(See here, Eclipse Force.com IDE Installation)as my development environment. I don't think it is difficult to use, but it could more friendly. For example: 1. It doesn't support APEX an...
Instantiating an Apex class based on dynamic strin... Somtimes we need to instantiate a Apex class by dynamic value in Salesforce, which can make our program more modular and more readable, such as the below case : 1. Each Contact has its socail fields : "Type__c" and "AccessToken__c" 2. Needs to request its profile via socail api in Apex Firs...
Using Aggregate SOQL queries/results in Batch Apex In previous post, we had created a schedulable batch apex that implements Database.Batchable in Salesforce, but if you want to use SOQL having aggregate functions like SUM(), MAX(), COUNT() on results grouped by “GROUP BY” clause in start execution, changing to interface Database.Ba...