I currently use ColdFusion 11 as a local server for development.
I have a JSON string that is serialized with ColdFusion . Within the string I have to insert a code "99" in the object "Payment_form". The Api required in the response tells me that the Payment_form object be a string.
Knowing about problems with ColdFusion serialization with JSON string and the numerical representation, look here at StackOverflow and find a solution by placing a "chr(2)".
The problem was solved.... but only in ColdFusion 11. When I uploaded the code to the ColdFusion hosting (hostek.com/CF2016) it stopped working, because chr(2) returns the value "/u000299" and consequently the API responds with an error.
I assumed that ColdFusion 2016 changed the handling of chr(), but in the documentation of both versions there are no changes in the handling of this function.
It seems that CF/2016 is changing (Escaped Unicode) according to the ASCII table.
So?. Anyone know how to fix this?
- Does this relate to the hosting service?
- Hostek.com have a different encoder to my local server?
I hope someone has some advice for this. Thank you
<cfset requestData = {"customer": "#customer#"
, "items":#empStruct#
, "payment_form":"#chr(2)#99"
, "payment_method": "#payment_method#"
, "use": "#use#"
, "folio_number": "#folio_number#"
, "series": "#series#"
}>
Serliaze Exit Chain with Coldfusion 11 (local server My_pc)
{
"payment_form": "99",
"series": "F",
"use": "G03",
"customer": "5d965ab97419177948b59a26",
"payment_method": "PPD",
"items": [
{
"quantity": 2,
"product": "5d9639d27419177948b59a0b"
},
{
"quantity": 15,
"product": "5d9639e07419177948b59a0c"
}
],
"folio_number": 7400
}
Serialize Exit Chain with ColdFusion 2016 (Coldfusion Hosting Hostek.com)
{
"payment_form": "\\u000299",
"series": "F",
"use": "G03",
"customer": "5d9691f17419177948b59a68",
"payment_method": "PPD",
"items": [
{
"quantity": 500,
"product": "5d9d30bc08b8ad3f683e81bc"
},
{
"quantity": 500,
"product": "5d9d30c908b8ad3f683e81bd"
}
],
"folio_number": 7840
}
