Guest User

Untitled

a guest
Nov 13th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <cfscript>
  2. // Just a new line.
  3. x="
  4. ";
  5.  
  6. // This shows only chr(10) for both Lucee and ACF
  7. writeoutput( "pre-serialize char: ") ;
  8. for ( j=1;j<=len(x);j++) {
  9. writeoutput( x.right(j).asc() & " " ) ;
  10. }
  11.  
  12. writeoutput("<br>");
  13.  
  14. // Serialize x to JSON
  15. y=serializeJSON(x);
  16.  
  17. // Which gives us:
  18. writeoutput("serialized= " & y & "<br>");
  19.  
  20. //Now deserialize to see what characters are there:
  21. z = deserializeJSON(y) ;
  22.  
  23. // What characters are there?
  24. writeoutput( "post-serialize char: " ) ;
  25. for ( i=1;i<=len(z);i++) {
  26. writeoutput( z.right(i).asc() & " " ) ;
  27. }
  28.  
  29. /* LUCEE 5
  30. pre-serialize char: 10 13
  31. serialized= "\r\n"
  32. post-serialize char: 10 13
  33. */
  34. /* ACF 11+
  35. pre-serialize char: 10
  36. serialized= "\n"
  37. post-serialize char: 10
  38. */
  39.  
  40. /*
  41. Lucee: newLine() == \n
  42. */
  43. </cfscript>
Add Comment
Please, Sign In to add comment