Coder Social home page Coder Social logo

[DISC] Percent decoding about serde_urlencoded HOT 5 CLOSED

nox avatar nox commented on July 28, 2024
[DISC] Percent decoding

from serde_urlencoded.

Comments (5)

erwanvivien avatar erwanvivien commented on July 28, 2024 1

Hello @ckcr4lyf,

I'm still, to this day, using the said "hack"...
I do not understand @nox answer, serde_urlencode doesn't use https://github.com/servo/rust-url/ ?

Why is there no function to decode only the keys, not the values ?

id=6%206&abc=123&def=2%252 yieding {"id": "6%206", "def": "2%252", "abc": "123"} as mentionned before.

Thanks

from serde_urlencoded.

nox avatar nox commented on July 28, 2024

You probably want to file an issue at https://github.com/servo/rust-url/ and use the percent_encoding crate directly.

from serde_urlencoded.

ckcr4lyf avatar ckcr4lyf commented on July 28, 2024

@erwanvivien wondering if you were able to come across a solution? Thanks to your hack I am able to get my current code working (i.e no invalid UTF8 error), but receiving raw bytes in URL params is proving to be a problem to otherwise decode currently...

Current hack (inspired by yours: ckcr4lyf/kiryuu@2536307#diff-42cb6807ad74b3e201c5a7ca98b911c5fa08380e942be6e4ac5807f8377f87fcR29)

from serde_urlencoded.

ckcr4lyf avatar ckcr4lyf commented on July 28, 2024

I am not too sure myself, I wasn't really able to read the source that well... I will try and figure out if the % decoding is an issue at this library's usage of rust-url or it comes due to a higher level issue of auto decoding in rust-url

from serde_urlencoded.

ckcr4lyf avatar ckcr4lyf commented on July 28, 2024

@erwanvivien seems it is a design choice by the parent library to not support invalid UTF-8, as is mentioned in this spec which they follow - https://url.spec.whatwg.org/#urlencoded-parsing

Guess no choice except the hack, thanks for sharing it!

from serde_urlencoded.

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.