Giter Site home page Giter Site logo

Comments (9)

dunglas avatar dunglas commented on May 22, 2024

I don't understand what you're trying to do exactly. Changing line breaks in a JSON document?

from api-platform.

theofidry avatar theofidry commented on May 22, 2024

Windows –> NIX:

tr -d '\r' < windowsfile > nixfile // delete the carriage returns

Mac –> NIX:

tr '\r' '\n' < macfile > nixfile // translate carriage returns into newlines

NIX –> Mac:

tr '\n' '\r' < macfile > nixfile // translate newlines into carriage returns

If you want to do that in Git you can simply configure your git return line and do a git add -A. If you absolutely need to do that in PHP look for the carriage return character and replace it manually.

Can't really help much more as I have no idea of what your use case is...

from api-platform.

teohhanhui avatar teohhanhui commented on May 22, 2024

I'm not talking about source files but HTTP entity body (in JSON, for example). This question is about sanitizing user (API consumer) input.

from api-platform.

teohhanhui avatar teohhanhui commented on May 22, 2024

Windows browsers are required by HTML spec to normalize line breaks as CRLF during form submission. Not exactly our use case here, but I hope you get my point... The API probably needs to normalize the line breaks.

from api-platform.

dunglas avatar dunglas commented on May 22, 2024

You mean the value of a textarea encoded in a JSON document or something like that?

from api-platform.

teohhanhui avatar teohhanhui commented on May 22, 2024

@dunglas

You mean the value of a textarea encoded in a JSON document or something like that?

Yes.

from api-platform.

Simperfit avatar Simperfit commented on May 22, 2024

@teohhanhui What could we do about this ?

from api-platform.

teohhanhui avatar teohhanhui commented on May 22, 2024

I'm not sure, to be honest. This is an open question to hear the experiences of others and how they deal with the problem.

from api-platform.

Simperfit avatar Simperfit commented on May 22, 2024

As this don't get any feedback, i'm closing here. Maybe we could create a proposal on the core repository ?

from api-platform.

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.