Questions tagged [decodeuricomponent]
56 questions
47
votes
2 answers
Javascript decodeURI(Component) malformed uri exception
I entered the following in Chrome's console:
decodeURIComponent('a%AFc');
Instead of resulting to a0xAFc, it caused a URIError exception (malformed uri).
I've heard several excuses why this may be possible, but what I don't understand is why?
The…

Christian
- 27,509
- 17
- 111
- 155
22
votes
8 answers
Why does decodeURIComponent('%') lock up my browser?
I was just testing something with AJAX and I found that on success if I alert
alert(decodeURI('%'));
or
alert(encodeURIComponent('%'));
the browser errors out with the following code.
$.ajax({
type: "POST",
url: "some.php",
data: "",
…

CristiC
- 22,068
- 12
- 57
- 89
11
votes
1 answer
Express URL parameter feature doesn't decode plus (+) as space
When using Express' URL parameter functionality, it seems that parameters are automatically decoded. That is, percent-encoded entities are resolved to their normal form. %20 is replaced with a space.
However, a plus + is not replaced with a space.…

Brad
- 159,648
- 54
- 349
- 530
6
votes
3 answers
Lua - decodeURI (luvit)
I would like to use decodeURI or decodeURIComponent as in JavaScript in my Lua (Luvit) project.
JavaScript:
decodeURI('%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82')
// result:…

Kosmetika
- 20,774
- 37
- 108
- 172
5
votes
3 answers
NodeJS decodeURIComponent not working properly
When I tryed to decode the string below in nodeJS using decodeURLCompnent:
var decoded = decodeURI('Ulysses%20Guimar%C3%A3es%20-%20lado%20par');
console.log(decoded);
I got
Ulysses Guimarães - lado par
Instead of
Avenida Ulysses Guimarães - lado…

nanndoj
- 6,580
- 7
- 30
- 42
3
votes
3 answers
What is the format in jq for calling a custom module?
I need to url decode a string in a json structure using jq. I have a custom module defined under ~/.jq/urldecode.jq but when calling it:
jq '.http.referrer | url_decode::url_decode' file.json
I get the error message:
jq: 1 compile error
The module…

brian2013
- 766
- 7
- 7
2
votes
0 answers
PHP rawurlencode followed by JS decodeURIComponent gives malformed URI error
I have this piece of code that encodes an array of results from a database search:
foreach($searchResults[$i] as $key => $value) {
$searchResults[$i][$key] = rawurlencode($value);
}
I had to encode in order to pass the data as JSON to…

N.Sawyer
- 21
- 4
2
votes
1 answer
can someone tell me the why we need decodeURIComponent
I have this piece of code that I couldn't find any explanation for. When I googled decodeURIComponent it said it is the reverse of encodeURIComponent, however, I can't find encodeURIComponent anywhere in my code.
getParameterByName = (name, url) =>…

JS Lover
- 622
- 5
- 16
2
votes
0 answers
encodeURIComponent keeps on returning URI error
Ok here is the thing. Our site has a bookmarklet and it works fine in all major browsers except Safari. I investigated and found out that it was because of two reasons:
Safari 5.5 has a 2347 char limit on any URL.
It encodes the URI.
I've solved…

GarbageGigo
- 303
- 2
- 10
1
vote
0 answers
Is there a way to handle URIError in React?
Some days ago I was working on an issue for my job where a page on React couldn't "catch" an error when someone tried to navigate using a bad URL that had the percentage sign (%) that can't be decoded.
The React project uses react-router-dom to…

FerJoTello
- 11
- 3
1
vote
0 answers
How to recover from decodeURI(encodeURIComponent(originalString))?
I have some legacy code (pre-React) that encodes part of a URL with encodeURIComponent before calling history.push() on the https://www.npmjs.com/package/history module in order to navigate to that URL.
history.push() inside history.js then uses…

Chris
- 4,212
- 5
- 37
- 52
1
vote
0 answers
Unable to decode URI for Chinese characters in a URL in Gatsby
I'm using Gatsby with Strapi as a headless CMS for a multi-lingual blog. It appears that in some (not all) of the Chinese blog posts the slug arrives encoded. I attempted to use the following:
const decodeSlug = (slug.includes("%")) ?…

stahldom
- 21
- 3
1
vote
2 answers
decodeURI not working with innerHTML text
I've been trying decode text, so I can take unescape JSON encoding. But I can't get to work when the variable value is innerHTML but it works when I hardcode the same string value to the variable.
innerHTML Example (I need help…

DN0300
- 864
- 2
- 12
- 27
1
vote
0 answers
Intercepting ajax request with decodeURIComponent resulting in special characters
I am trying to intercept every outgoing AJAX request and log it. I am using following code.
$.ajaxSetup({
beforeSend: function (xhr,settings) {
console.log(decodeURIComponent(settings.data), settings.url);
}
});
I want output in…

OpenStack
- 5,048
- 9
- 34
- 69
1
vote
1 answer
how to decode data from api to base64 in .html file using ionic 3
i'm trying to view inside page.html file some data comes from API and this data is only long text encode via base64 , well the problem is i want to decode the text inside html file not at page.ts file so i tried many logic for that but nothing works…