Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Escape UTF+2028 and UTF+2029

    Hi,

    I am using SmartGWT 3.1.

    I noticed a problem:
    The user manages to input an UTF+2028 or UTF+2029 (LINE SEPARATOR) character into the application, which is successfully saved to the db. When this content would be shown to the user, then it breaks the application, because these characters are valid in JSON, but means a line break for JavaScript. See: http://timelessrepo.com/json-isnt-a-javascript-subset

    So, for example I have a field in a record, which contains a 2028, when the server sends it to the client as a valid JSON string value with a line break, then the JavaScript on the client won't be able to interpret it, because the line ends in the middle of a value.

    First I escaped these characters during the saving of the input, but now it happens at another place. I cannot replace all of the input strings all over the application. Some records are imported from an XLS file, so I think the solution would be to escape these special UTF characters by the JSON serializer, when sending content to the client, so it wouldn't cause any JavaScript issue.

    Is there any existing solution for this? Was this solved in a newer version? Or should I update some library, where this is fixed?

    Thanks!

    #2
    Hi mikereem,

    see this post. The issue is fixed in 5.0p.
    I don't know if this will be fixed in such an old version as well (see here).

    Best regards
    Blama

    Comment


      #3
      Hi Blama ,

      Thanks for pointing me to that post! I thought this issue should have been found by somebody already, just I wasn't able to find that post.

      Great that it is already fixed in 5.0p, thats another point on our list why we should update...

      Best regards,
      mikereem

      Comment

      Working...
      X