By Ryan Hayes

2013-01-29 02:28:49 8 Comments

This isn't Twilio specific, but the issue does cause the Twilio API call to fail..

I'm wanting to generate an XML file via Twilio's lab:

The above URL works great as a parameter in the API and obviously works if you use your browser to view the output.

I can also view the following in the browser, and it works fine, but this version of the URL fails as a parameter to the Twilio API><Say>Hi+there.</Say></Response>

For readability and debugging I would much prefer to have the second URL. Is there a library or other way in C# to convert the second, pretty URL to the first, replacing %3C with the '<' character and so on? I could then just do the replacement right before I send it off to the API since my app pushes around and stores the pretty version everywhere else. I can of course write one myself to do the conversion, but it seems like this would be a common problem. Thanks!


@Hanlet Escaño 2013-01-29 02:40:14

Is this perhaps what you are looking for?

private void Form1_Load(object sender, EventArgs e)
    string encoded = "";
   string decoded = Uri.UnescapeDataString(encoded);

Output - Unescaped string:<Response><Say>Hi+there.</Say></Response>

And back to normal:

string encoded = Uri.EscapeDataString(decoded);

Output - escaped string:

Related Questions

Sponsored Content

20 Answered Questions

[SOLVED] Get the current URL with JavaScript?

  • 2009-06-23 19:26:45
  • dougoftheabaci
  • 2515638 View
  • 2673 Score
  • 20 Answer
  • Tags:   javascript url

31 Answered Questions

[SOLVED] What is the difference between a URI, a URL and a URN?

  • 2008-10-06 21:26:58
  • Sean McMains
  • 1017945 View
  • 3962 Score
  • 31 Answer
  • Tags:   http url uri urn rfc3986

24 Answered Questions

[SOLVED] Case insensitive 'Contains(string)'

14 Answered Questions

[SOLVED] Encode URL in JavaScript?

57 Answered Questions

[SOLVED] What is the difference between String and string in C#?

73 Answered Questions

[SOLVED] How can I get query string values in JavaScript?

13 Answered Questions

[SOLVED] How to change the URI (URL) for a remote Git repository?

  • 2010-03-12 12:48:47
  • e-satis
  • 1187821 View
  • 3034 Score
  • 13 Answer
  • Tags:   git url git-remote

30 Answered Questions

[SOLVED] Get current URL with jQuery?

18 Answered Questions

[SOLVED] How to modify the URL without reloading the page?

16 Answered Questions

[SOLVED] What is the maximum length of a URL in different browsers?

  • 2009-01-06 16:14:30
  • Sander Versluys
  • 1071547 View
  • 4355 Score
  • 16 Answer
  • Tags:   http url browser

Sponsored Content