0
Hey, here’s the deal. On the site that I’m building, I write information in the database, this information is a json, to be able to send this data to the database, I code it by javascript like this:
encodeURI(dados);
After that I send via jquery and write to the database..
So far all beauty, only that I need to recover this data in a windows Forms software, in c#, I am looking for a way to decode this information, I tried that:
using System;
using System.Net;
...
Conecto ao banco de dados, pego a informação do jeito que está la em um string, e peço pra mostrar numa show box
MessageBox.Show(WebUtility.HtmlDecode(pedidos));
Except that it is not decoding, the result is still coming back the same is in the database, all encoded as if it were a URI
%5B%0A%09%7B%0A%09%09%22id%22%3A%221%22%2C%0A%09%09%22produto%22%3A%22VENEZA%22%2C%0A%09%09%22preco%22%3A%2242.00%22%2C%0A%09%09%22quantidade%22%3A1%0A%09%7D%0A%5D
Then I saw several websites teaching this there, but I import the System.Web library, but this Httputility function does not appear as if it did not exist
– Shari Sharu
Error when importing library?
– Laerte
Ah, I get it now, I need to add it as a reference..
– Shari Sharu
That, in case it doesn’t work out, try:
Uri.UnescapeDataString
– Laerte
They both worked, thank you
– Shari Sharu
If the answer helped you mark as accepted to help others who have the same question! :)
– Laerte