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


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.