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

SRP_JSON converts text differently

I have some code which uses SRP_JSON to convert text to JSON
In the past it converts the text correctly, now it seems something has changed since the last update of SRP utilities

I have an example of my code here:

If SRP_JSON(RootHandle, "NEW") then If SRP_JSON(ArrayHandle, "NEW", "ARRAY") then If SRP_JSON(ObjectId, "NEW") then SRP_JSON(ObjectId, 'setValue', 'Name', 'André', 'STRING') SRP_JSON(ArrayHandle, 'ADD', ObjectId) SRP_JSON(ObjectId, 'RELEASE') end SRP_JSON(RootHandle, 'SET', "Login", ArrayHandle) SRP_JSON(ArrayHandle, 'RELEASE') end // Now get the actual JSON rv = SRP_JSON(RootHandle, "STRINGIFY", "Fast") // All done with the root object SRP_JSON(RootHandle, "RELEASE") end

this results in :
{"Login":[{"Name":"Andr\uffffffe9"}]}

while it used to result in :
{"Login":[{"Name":"André"}]}
It seems this has something to do with some encoding issue

Is it possible to make it optionable which encoding is used?

Comments

  • Even if UTF-16 was intended by SRP_JSON, the output should have been
    {"Login":[{"Name":"Andr\u00e9"}]}

    So converting é to \uffffffe9 is invalid anyways, imho.
  • SRP Utilities 2.0.3 RC3 fixes this. It was never meant to output \u sequences for anything except control characters, so that was the first problem. The second problem, as @r.od.akker point out, was the 32-bit length sequence instead of the 16-bit sequence. Both have been corrected.

    In short, it should now output as you preferred without having to ask it to.
  • Thanks Kevin! We installed the new RC and the problem seems to be fixed
Sign In or Register to comment.