Robert_Wilson
New Member
Hey Guys,
Some back story to this, I'm developing some IM chat functionality using node and Openedge 11.7. When the agents and customers message each other there is a ping to a rest endpoint through PAS to store the message in our DB. The issue I've got just now is that when the message comes in if there is, for example, a pound sign that can't be converted from UTF-8 to 1251 (our cpinternal codepage) th GetJsonText function break with Unexpected UTF-8 bit pattern 0xa0 in WRITE-JSON( ). (15353).
I'm looking to see if anyone has any pointers on how best to deal with this. I've tried converting the codepage of my long char to UTF-8 but the error persists, another idea I had was to URL encode the message data and then decode on the backend but URL-DECODE() only seems available in webspeed.
Here's a snippet of the code:
Thanks in advance,
Robert.
Some back story to this, I'm developing some IM chat functionality using node and Openedge 11.7. When the agents and customers message each other there is a ping to a rest endpoint through PAS to store the message in our DB. The issue I've got just now is that when the message comes in if there is, for example, a pound sign that can't be converted from UTF-8 to 1251 (our cpinternal codepage) th GetJsonText function break with Unexpected UTF-8 bit pattern 0xa0 in WRITE-JSON( ). (15353).
I'm looking to see if anyone has any pointers on how best to deal with this. I've tried converting the codepage of my long char to UTF-8 but the error persists, another idea I had was to URL encode the message data and then decode on the backend but URL-DECODE() only seems available in webspeed.
Here's a snippet of the code:
Code:
/* Parse the json data and pull out the required information */
ASSIGN
omp = NEW ObjectModelParser()
jsonParam = CAST(omp:Parse(icJSON),JsonObject)
cAuth = jsonParam:GetCharacter('authId')
lcImChatMsg = jsonParam:GetJsonText('messageData') //code is failing here with the above error
lAgent = LOGICAL(jsonParam:GetJsonText('isAgent')).
/* The frontend likes to escape slashes so unescape them so that dates can be read into the temp-table correctly */
ASSIGN lcImChatMsg = REPLACE(lcImChatMsg,"\/","/").
/* read the message data into the imchat temp-table */
EMPTY TEMP-TABLE ttimChat NO-ERROR.
ASSIGN hTemp = TEMP-TABLE ttimChat:DEFAULT-BUFFER-HANDLE.
hTemp:READ-JSON("LONGCHAR", lcImChatMsg).
Thanks in advance,
Robert.