3

How can I detect the encoding of this string :

    "http://sinapress.ir/resize/directory/مجامع علمی/1439280705853632083.jpg/263/171"

The orginal string is :

    "http://sinapress.ir/resize/directory/مجامع علمی/1439280705853632083.jpg/263/171"

And how can I convert first string to second string in c#?

TaW
  • 53,122
  • 8
  • 69
  • 111
MahdiAliz
  • 65
  • 1
  • 7
  • 1
    Looks like URL- encoding. There is `Sytem.Net.HttpUtility` class that should have a function for encoding and decoding. – bash.d Aug 16 '15 at 13:25
  • I was worked with HttpUtility.UrlDecode but not respond in this string but work on another string. – MahdiAliz Aug 16 '15 at 13:28
  • possible duplicate of [How can I decode HTML characters in C#?](http://stackoverflow.com/questions/122641/how-can-i-decode-html-characters-in-c) – Orel Eraki Aug 16 '15 at 13:28

2 Answers2

5

You can use HttpUtility.HtmlDecode

var urlToDecode = "http://sinapress.ir/resize/directory/مجامع علمی/1439280705853632083.jpg/263/171";
Console.WriteLine(HttpUtility.HtmlDecode(urlToDecode));
Orel Eraki
  • 11,940
  • 3
  • 28
  • 36
1

its normal html encoding. just use HttpUtility.HtmlDecode()

Teo
  • 139
  • 1
  • 1
  • 8