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!
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!
Comment