tracker issue : CF-3342124

select a category, or use search below
(searches all categories and all time range)

XML serialization for REST services is not escaping some values.

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/CannotReproduce

Reporter/Name(from Bugbase): Raymond Camden / Raymond Camden (Raymond Camden)

Created: 10/06/2012

Components: REST Services

Versions: 10.0

Failure Type: Data Loss

Found In Build/Fixed In Build: Final /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Mac 10.7 64-bit

Vote Count: 1

Take the OWS database from the CFWACK and use this simple query:

   remote query function list() httpmethod="get" {
      var q = new com.adobe.coldfusion.query();
      q.setSQL("select movietitle, pitchtext, amountbudgeted, summary, imagename, dateintheaters from films order by movietitle asc");
      var results = q.execute().getResult();

      return results;

When I run this via REST and ask for XML, I get an error because a character is not escaped: 

falls for his fianc?'s

It's probably a high ascii character in the database. But it should be handled by ColdFusion natively when serializing to XML.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3342124

External Customer Info:
External Company:  
External Customer Name: cfjedimaster
External Customer Email:  
External Test Config: My Hardware and Environment details:



It's not that it's not ESCAPING it, Ray: and e-acute is not a "special character" in XML so it doesn't need to be escaped. It's that the response is not being encoded properly (ie: as UTF-8). There doesn't seem to be a way to tell the function which charset to encode the data with that I can find (and THIS is the bug here). I'd say this is quite significant, as it basically renders RESTful web services unusable for most of the world (the bits that have diacritic marks in their alphabets, which is pretty much everywhere that English is not the first language).
Comment by External U.
17702 | October 07, 2012 05:31:15 AM GMT
UTF-8 characters should be supported automatically by ColdFusion.
Vote by External U.
17708 | August 26, 2013 05:44:32 PM GMT
We dont have OWS database. Can you please give us the data in films table causing this issue. (Comment added from ex-user id:nawani)
Comment by Adobe D.
17703 | October 03, 2013 02:59:53 AM GMT
Please see what Adam said. It should be easy to recreate. If you really want to test w/ OWS, download it from here:
Comment by External U.
17704 | October 03, 2013 04:46:18 AM GMT
You will be able to pass the encoding using the HTTP Header. If your request data needs to read using a specific encoding, You can specify it using the Content-Type request header. Content-Type: text/xml; charset=UTF-8 Similarly, if you can specify the charset for the response also, using the Accept header. Accept: text/xml;charset=UTF-8 Can you try your test case using the charset in Accept header?
Comment by Paul N.
17705 | November 25, 2014 03:14:58 AM GMT
Can you try using Accept header and verify, that should solve your problem. Let us know if this works.
Comment by HariKrishna K.
17706 | December 03, 2014 12:28:22 AM GMT
Since there has been no response, closing the bug. If you are still facing the issue, please revert with a reproducible case, will re-open the bug.
Comment by HariKrishna K.
17707 | December 08, 2014 02:48:14 AM GMT