Status/Resolution/Reason: Closed/Won't Fix/
Reporter/Name(from Bugbase): Joseph Witthuhn / Joseph Witthuhn (Joseph Witthuhn)
Created: 05/15/2013
Components: Language, Serialization
Versions: 9.0.1
Failure Type:
Found In Build/Fixed In Build: 11.0 / CF10_Update14
Priority/Frequency: Normal / Few users will encounter
Locale/System: English / Windows 7
Vote Count: 2
Problem Description:
The SerializeJSON function does not correctly handle control characters in Strings. It passes them through as-is, instead of escaping them using \uXXXX (where each X is a hexadecimal digit). This means that some JSON parsers (which insist that the data follows the rules), including Jackson, cannot handle the output. This is described at http://json.org or more formally in RFC 4627 at http://www.ietf.org/rfc/rfc4627.txt?number=4627
The form required me to pick a platform, but it seems to be a bug on all platforms (see test configuration below).
Steps to Reproduce:
Create a Struct, and load some String values in that contain control characters. Pass this into SerializeJson and examine the output.
Actual Result:
The control characters are not encoded.
Expected Result:
The control characters should be escaped with \uXXXX as described above.
Any Workarounds:
First use a RegEx to strip all control characters (for example, using REReplace).
Example of workaround: REReplace(SerializeJSON(inputStruct), "[\x00-\x08\x0B\x0C\x0E-\x1F]+", " ", "all")
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3561029
Deployment Phase: Release Candidate
Keywords:
FixTested
External Customer Info:
External Company:
External Customer Name: joseph.witthuhn
External Customer Email:
External Test Config: Reproduced on two configurations:
Windows 7 Professional Service Pack 1
Adobe ColdFusion 9.0.1
Running as a single server on IIS
SUSE Linux
Adobe ColdFusion 9.0.1 with Cumulative Hotfix 2
Running as a WAR file on Tomcat 6
Attachments:
Comments: