Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#18716 closed defect (invalid)

Json stringify doesn't handle unicode characters

Reported by: pdupless Owned by: pdupless
Priority: undecided Milestone: tbd
Component: Core Version: 1.10.4
Keywords: Cc:
Blocked By: Blocking:


Json stringify in the absence of the json object doesn't escape Unicode characters.

Unicode characters can be introduced when copying text into textarea fields from common applications such as Microsoft Outlook.

The addition of the code below to the declaration of the escapeString function would resolve the issue.

.replace(/[\u007f-\uffff]/g, function(c) { return '
u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4); });

Change History (4)

comment:1 Changed 6 years ago by bill

Why do you think it should escape non-ascii characters?

comment:2 Changed 6 years ago by bill

Owner: set to pdupless
Status: newpending

comment:3 Changed 6 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:4 Changed 6 years ago by bill

FYI, AFAIK the only character that needs to be escaped is the double quote. It sounds like you had an encoding problem in your app (transferring non-ascii characters to the browsers, or storing non-ascii characters in your database, etc.) and you wanted to use Json stringify to work around the problem.

Note: See TracTickets for help on using tickets.