Giter Club home page Giter Club logo

Comments (3)

mck89 avatar mck89 commented on June 1, 2024

That's how it should work, setValue makes sure it stores exactly the value you pass in, so it applies all the required escaping.
Right now the only way to add a unicode escaped sequence is to use the setRaw method like this:

$str->setRaw("'\u0076\u0061\u0072\u0069\u0061\u0062\u006c\u0065\u0073'");

It takes the exact string representation so the value should be surrounded by quotes.

That's ugly, i know, but i'll try to think about a better handling for the next releases.

from peast.

Domi04151309 avatar Domi04151309 commented on June 1, 2024

Thanks for the quick reply. The setRaw method works well. Since I do not have enough expertise here I was wondering why the input would have to be escaped in the first place. I realized this behavior after using the renderer where the result did show the characters with double slashes.

from peast.

mck89 avatar mck89 commented on June 1, 2024

I think that escaping the input is the right behaviour for the setValue method because it guarantees that what you pass to the method is exactly what you will get in the string when you will render it. Handling of unicode escaped sequence is the only downside of this behaviuour, maybe adding a setRawValue method with the benefits of setRaw but without the need of surrounding quotes can be the right solution, i will evalutate it for a future release.

from peast.

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.