The inline editor widget reports a JSON error when saving non-ASCII characters
Bug #331990 reported by
Māris Fogels
This bug affects 34 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
High
|
Leonard Richardson | ||
lazr.restful |
Fix Released
|
High
|
Leonard Richardson |
Bug Description
When saving a Bug title that contains unicode characters, using the Inline Editor widget, you receive the following error:
"Entity-body was not a well-formed JSON document."
The server returns a response code of 400, Bad Request.
At a glance, the JSON string being sent to the server appears to be well-formed, but this should be verified using the JSON parsers on both the client and server.
Changed in launchpad-foundations: | |
assignee: | nobody → mars |
importance: | Undecided → High |
status: | New → Triaged |
summary: |
- The inline editor widget reports a JSON error when saving Unicode + The inline editor widget reports a JSON error when saving non-ASCII characters |
Changed in launchpad-foundations: | |
assignee: | Māris Fogels (mars) → Tom Berger (intellectronica) |
milestone: | none → 2.2.6 |
Changed in launchpad-foundations: | |
status: | Triaged → In Progress |
Changed in lazr.restful: | |
status: | Fix Committed → Fix Released |
Changed in launchpad-foundations: | |
status: | Fix Committed → Fix Released |
Changed in lazr.restful: | |
status: | Triaged → Fix Released |
Changed in launchpad-foundations: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Here's roughly how to escape the string:
String. prototype. toJSON = function() /[\\"'\ x00-\x1F\ u0080-\ uFFFF]/ g, function(c) { 0).toString( 16)).slice( -4);
{
return '\''+ this.replace(
switch (c) {
case "\b": return '\\b';
case "\t": return '\\t';
case "\n": return '\\n';
case "\f": return '\\f';
case "\r": return '\\r';
case '"' : return '\\"';
case '\'': return '\\\'';
case '\\': return '\\\\';
}
return '\\u' + ('0000' + c.charCodeAt(
}) +'\'';
}