mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
JSON: Fix encoding of BEL character
This commit is contained in:
parent
0a78fefecb
commit
379afb1e3f
2 changed files with 34 additions and 12 deletions
|
|
@ -87,6 +87,29 @@ invokeMethod() non-virtual forces users to add methods with setMethod() instead
|
||||||
of overriding invokeMethod(), which is more compatible with QuickJS.
|
of overriding invokeMethod(), which is more compatible with QuickJS.
|
||||||
|
|
||||||
|
|
||||||
|
## Change
|
||||||
|
|
||||||
|
The ASCII and Unicode BEL character (U+0007) escape sequence has changed in the
|
||||||
|
JSON encoder from "\a" to "\u0007".
|
||||||
|
|
||||||
|
**Possible Issues**
|
||||||
|
|
||||||
|
Reliance on the raw JSON encoded string literal, for example for file comparison,
|
||||||
|
base-64 encoding, or any encryption, may result in false negatives for JSON data
|
||||||
|
containing a BEL character between versions of JUCE.
|
||||||
|
|
||||||
|
**Workaround**
|
||||||
|
|
||||||
|
Use string replace, for example call `replace ("\\u007", "\\a")` on the
|
||||||
|
resulting JSON string to match older versions of JUCE.
|
||||||
|
|
||||||
|
**Rationale**
|
||||||
|
|
||||||
|
The JSON specification does not state that the BEL character can be escaped
|
||||||
|
using "\a". Therefore other JSON parsers incorrectly read this character when
|
||||||
|
they encounter it.
|
||||||
|
|
||||||
|
|
||||||
## Change
|
## Change
|
||||||
|
|
||||||
The LowLevelGraphicsPostscriptRenderer has been removed.
|
The LowLevelGraphicsPostscriptRenderer has been removed.
|
||||||
|
|
@ -104,7 +127,7 @@ into your own project/module and use them that way.
|
||||||
**Rationale**
|
**Rationale**
|
||||||
|
|
||||||
We are not aware of any projects using this functionality. This renderer was
|
We are not aware of any projects using this functionality. This renderer was
|
||||||
not as fully-featured as any of the other renders, so it's likely that users
|
not as fully-featured as any of the other renderers, so it's likely that users
|
||||||
would have filed issue reports if they were using this feature.
|
would have filed issue reports if they were using this feature.
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -545,14 +568,14 @@ implementation wrapping the QuickJS engine.
|
||||||
**Possible Issues**
|
**Possible Issues**
|
||||||
|
|
||||||
Code that previously successfully evaluated using JavascriptEngine::evaluate()
|
Code that previously successfully evaluated using JavascriptEngine::evaluate()
|
||||||
or JavascriptEngine::execute(), could now fail due to the rules applied by the
|
or JavascriptEngine::execute(), could now fail due to the rules applied by the
|
||||||
new, much more standards compliant engine. One example is object literals
|
new, much more standards compliant engine. One example is object literals
|
||||||
e.g. { a: 'foo', b: 42, c: {} }. When evaluated this way the new engine will
|
e.g. { a: 'foo', b: 42, c: {} }. When evaluated this way the new engine will
|
||||||
assume that this is a code block and fail.
|
assume that this is a code block and fail.
|
||||||
|
|
||||||
**Workaround**
|
**Workaround**
|
||||||
|
|
||||||
When calling JavascriptEngine::evaluate() or JavascriptEngine::execute() the
|
When calling JavascriptEngine::evaluate() or JavascriptEngine::execute() the
|
||||||
code may have to be updated to ensure that it's correct according to the
|
code may have to be updated to ensure that it's correct according to the
|
||||||
Javascript language specification and in the context of that evaluation. Object
|
Javascript language specification and in the context of that evaluation. Object
|
||||||
literals standing on their own for example should be wrapped in parentheses
|
literals standing on their own for example should be wrapped in parentheses
|
||||||
|
|
|
||||||
|
|
@ -333,14 +333,13 @@ struct JSONFormatter
|
||||||
{
|
{
|
||||||
case 0: return;
|
case 0: return;
|
||||||
|
|
||||||
case '\"': out << "\\\""; break;
|
case '\"': out << "\\\""; break;
|
||||||
case '\\': out << "\\\\"; break;
|
case '\\': out << "\\\\"; break;
|
||||||
case '\a': out << "\\a"; break;
|
case '\b': out << "\\b"; break;
|
||||||
case '\b': out << "\\b"; break;
|
case '\f': out << "\\f"; break;
|
||||||
case '\f': out << "\\f"; break;
|
case '\t': out << "\\t"; break;
|
||||||
case '\t': out << "\\t"; break;
|
case '\r': out << "\\r"; break;
|
||||||
case '\r': out << "\\r"; break;
|
case '\n': out << "\\n"; break;
|
||||||
case '\n': out << "\\n"; break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (c >= 32 && c < 127)
|
if (c >= 32 && c < 127)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue