Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

JSON libraries handling special chars

We have a customer with the name "Univé Noord-Holland"
We send this customer with an API to an external system.
When we retrieve this customer we can get the customers name:
"id": 5234,
"name": "Naam",
"value": "Univ\u00e9 Noord-Holland"
the "é" is escaped in the json.
When we use RTI_JSON or SRP_JSONX_GET to decode "value" we get (correct) "Univé Noord-Holland" after we UTF8_ANSI the string because our OI is set to ANSI.

But when we use srp_json we get "UnivຠNoord-Holland" (raw)
converting it with UTF8_ANSI we get "Univ? Noord-Holland"

Can we get this right using SRP_JSON?

Regards Ed


  • Are you up to date? I get the same result (in non-UTF8 mode) using SRP_JsonX or SRP_Json in the following test code, which I ran on OI 9.4. SRP Utilities version 2.2.4.

    Compile Function Test(VOID) $insert SRPJSONX Declare function SRP_Json, UTF8_ANSI Declare subroutine SRP_Json Json = '{' Json := '"id": 5234,' Json := '"name": "Naam",' Json := '"value": "Univ\u00e9 Noord-Holland"' Json := '}' SRP_Jsonx_Parse("Test", Json) Test1 = SRP_Jsonx_Get("value") SRP_Jsonx_End() Test1 = UTF8_ANSI(Test1) Handle = 0 If SRP_Json(Handle, "Parse", Json) EQ "" then Test2 = SRP_Json(Handle, "GetValue", "value") SRP_Json(Handle, "Release") end Test2 = UTF8_ANSI(Test2) Ans = Test1 EQ Test2 Return Ans
  • we are at 2.2.03. We wil update and try again. We let you know.
    Thanks for now..

  • After update to the latest SRP Utilities the issue is gone.
    In the version history after 2.2 we only read that "Validate" was added to srp_json.
    Thanks again for the help.
  • Yeah, that's on me. I'm not exactly sure when I fixed it and I clearly forgot to make a note of it.
  • HELP!
    After installing the latest utlities....
    In an openengine service we have SRP issues..
    SRP_ENCODE break on line 67
    SRP_DECODE break on 62
    SRP_MATH break on line 89
    Are there dependencies?

  • Hold on.
    It looks like it's solved now....
  • Hey Don!
    I am sure the openengine service was restarted. Maybe I only restarted the dev-engine. After a re-restart it looks like everything is woking now.
Sign In or Register to comment.