Comments (5)
Well, if you encode it twice (TO_JSON plus string overload). I'll check if the overloading callback can be omitted for the TO_JSON case, but stacking both is the really the users fault. And I don't know if skipping the overload callback is ok then.
from cpanel-json-xs.
The problem is with S
which is not stacked. The TO_JSON
works as expected, even with an overload present.
Here is a (currently failing) testcase that I managed to create:
--- t/54_stringify.t
+++ t/54_stringify.t
@@ -34,6 +34,12 @@ my $enc = $json->encode( { obj => $object } );
is( $enc, '{"obj":"Foo <foo>"}', "mg object stringified" )
or diag($enc);
+$object = bless ["\x{1f603}"], 'Foo';
+$enc = $json->encode( { obj => $object } );
+
+is( $enc, "{\"obj\":\"Foo <\x{1f603}>\"}", "mg object stringified Unicode" )
+ or diag($enc);
+
$enc = $json->encode( { time => $time } );
isa_ok($time, "Time::Piece");
(Edit: updated to the right version of the diff)
from cpanel-json-xs.
Ok, I'll check if I get my head around it. Double encoding doesn't look too good then
from cpanel-json-xs.
Fix coming today. Just need to fix 5.8 also
from cpanel-json-xs.
Thank you for the quick turnaround!
from cpanel-json-xs.
Related Issues (20)
- values with IOK and pNOK (but not NOK) encoded as floating point, losing precision HOT 1
- Tests started failing again with recent perls and JSON 4.09 and JSON::PP 4.11
- "Subroutine JSON::PP::Boolean::(++ redefined" with newer perls HOT 2
- Remaining warnings with newer perls and JSON::PP HOT 3
- RFE: utf8(0) variant appropriate for byte strings HOT 26
- Check DOS attack via overlarge bignums
- memory leak when allow_nonref is off HOT 1
- Boolean eq overload breaks behaviour of JSON / JSON::XS modules HOT 1
- Bug: Wrong error messages/sometimes crashes or endless loops with invalid JSON in relaxed mode HOT 2
- Bug: allow_barekey decodes UTF-8 differently with and without quotes HOT 1
- Build is failing with C error: βforβ loop initial declarations are only allowed in C99 mode HOT 3
- Use faster SIMD utf8 validation
- builtin::true and builtin::false HOT 9
- Strange behvaiour with encode_json. HOT 1
- allow_singlequote should also allow \' HOT 2
- Inconsistent encoding of the empty string HOT 4
- unblessed_bool doesn't DWIM (or match the docs). HOT 3
- test failure with perl-5.38.0-RC0 (t/20_unknown.t) HOT 2
- JS-style comments HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpanel-json-xs.