1

This is encoded HTML code to be used at javascript function

<div class=\"ProductDetail\"><div style=\"width:780px\">\r\n\t<div class=\"baslik\" style=\"margin: 0px; padding: 5px 10px; border-width: 5px 0px 1px; border-top-style: solid; border-bottom-style: solid; border-top-color: rgb(255, 255, 255); border-bottom-color: rgb(153, 165, 165); vertical-align: baseline; color: rgb(0, 0, 0); clear: both; line-height: 14px; font-family: 'Lucida Grande', sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(219, 223, 226);\">    Di\u011fer \u00d6zellikler<\/div><\/div><\/div>

When decoded properly it becomes below

<div class="ProductDetail"><div style="width:780px">
<div class="baslik" style="margin: 0px; padding: 5px 10px; border-width: 5px 0px 1px; border-top-style: solid; border-bottom-style: solid; border-top-color: rgb(255, 255, 255); border-bottom-color: rgb(153, 165, 165); vertical-align: baseline; color: rgb(0, 0, 0); clear: both; line-height: 14px; font-family: 'Lucida Grande', sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(219, 223, 226);">    Diğer Özellikler</div></div></div>

This website has both decode and encode features

http://www.freeformatter.com/javascript-escape.html#ad-output

I could find HttpUtility.JavaScriptStringEncode at c# however i couldn't find any function class etc to decode encoded string

So i need help about how to decode like that website does

.net 4.5 c#

4
  • why not right click on their page and look at the Javascript [view source] that they are using and add it to your page.. the answer is actually right in front of you Commented Dec 16, 2014 at 23:47
  • @DJKRAZE i need it at c# not javascript Commented Dec 16, 2014 at 23:48
  • can you not add the javascript to your c# if not then I apologize for my comment Commented Dec 16, 2014 at 23:48
  • @DJKRAZE not you can not add. also their script is very hard to understand as you can guess perhaps even encrypted Commented Dec 16, 2014 at 23:49

3 Answers 3

4

Wow answer was so easy i just found out

and yet many experienced developers here voted my previous thread to close :D

Single line and works perfect

Regex.Unescape(string);
Sign up to request clarification or add additional context in comments.

Comments

1

Did you try:

        var unescapedString = Microsoft.JScript.GlobalObject.unescape(yourEscapedString);
        var escapedString = Microsoft.JScript.GlobalObject.escape(yourUnescapedString);

You should add Microsoft.JScript reference to your project.

Comments

0

The encoding shown is sufficient to make a JavaScript literal. This won't need any additional decoding as the interpreter will do it for you.

1 Comment

actually in my case i have to load decoded into the htmlagilitypack so i have to decode

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.