Giter Site home page Giter Site logo

Comments (5)

rurban avatar rurban commented on July 17, 2024

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.

jixam avatar jixam commented on July 17, 2024

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.

rurban avatar rurban commented on July 17, 2024

Ok, I'll check if I get my head around it. Double encoding doesn't look too good then

from cpanel-json-xs.

rurban avatar rurban commented on July 17, 2024

Fix coming today. Just need to fix 5.8 also

from cpanel-json-xs.

jixam avatar jixam commented on July 17, 2024

Thank you for the quick turnaround!

from cpanel-json-xs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.