Question: So from the textarea I take the shortcode `%91samurai id="19"%93` it should be `[samurai id="19"]`:

```
var not_decoded_content = jQuery('[data-module_type="et_pb_text_forms_00132547"]')
.find('#et_pb_et_pb_text_form_content').html();

```

But when I try to decode the `%91` and `%93` 

```
self.content = decodeURI(not_decoded_content);

```

I get the error:

> 
> Uncaught URIError: URI malformed
> 
> 
> 

How can i solve this problem?

Answer: 
The encodings are **invalid**. If you can't fix the whatever-system-produces-them to **correctly** produce %5B and %5D, then your only option is to do a replacement yourself: replace all %91 with character 91 which is '[', then replace all %93 with character 93 which is ']'.

Note that javascript String Replace as-is won't do "Replace all occurrences". If you need that, then create a loop (while it contains(...) do a replace), or search the internet for `javascript replace all`, you should find plenty results.

And a final note, I am used to using `decodeURIComponent(...)`. If you can make the whatever-system-produces-them to **correctly** produce %5B and %5D, and you still get that error, then try using `decodeURIComponent(...)` instead of `decodeURI`(...).
The string you're trying to decode is not a URI. Use `decodeURIComponent()` instead.

**UPDATE**

Hmm, that's not actually the issue, the issues are the `%91` and `%93`.

```
encodeURI('[]')

```

gives `%5b%5d`, it looks like whatever has encoded this string has used the decimal rather than hexadecimal value. 

```
Decimal 91 = hex 5b
Decimal 93 = hex 5d

```

Trying again with the *hex* values

```
decodeURI('%5bsamurai id="19"%5d') == '[samurai id="19"]'

```