Created
November 13, 2018 21:39
-
-
Save trycf/3507ed975dfe5aff36eaf2993aff2e8a to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// Just a new line. | |
x=" | |
"; | |
// This shows only chr(10) for both Lucee and ACF | |
writeoutput( "pre-serialize char: ") ; | |
for ( j=1;j<=len(x);j++) { | |
writeoutput( x.right(j).asc() & " " ) ; | |
} | |
writeoutput("<br>"); | |
// Serialize x to JSON | |
y=serializeJSON(x); | |
// Which gives us: | |
writeoutput("serialized= " & y & "<br>"); | |
//Now deserialize to see what characters are there: | |
z = deserializeJSON(y) ; | |
// What characters are there? | |
writeoutput( "post-serialize char: " ) ; | |
for ( i=1;i<=len(z);i++) { | |
writeoutput( z.right(i).asc() & " " ) ; | |
} | |
/* LUCEE 5 | |
pre-serialize char: 10 13 | |
serialized= "\r\n" | |
post-serialize char: 10 13 | |
*/ | |
/* ACF 11+ | |
pre-serialize char: 10 | |
serialized= "\n" | |
post-serialize char: 10 | |
*/ | |
/* | |
Lucee: newLine() == \n | |
*/ | |
</cfscript> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment