i need to parse data from other site but its encoded.
<div style="height: 250px" data-highchart="yes" data-encoded="#7JyYoFmc0JiO7JCd5BXZ}iojIhJXZhJSfsICbldWZuRmI6snIl5WYixWZkJiOmFGbzVWfsIyclJXalNnI*6s1ei4WYtVmI6ISQkZXYuRXYnVmIsIyYvx2byJiOiMSOyEUNyUjIsIibldWY#0lmdlN0bs9mciojIjMkMzMkMBJCLiYWasx2TwF2YpRXeioDMuQDLiQHayV2c]o9GbkJiOw4CMsICbp5WZXlGZ0hmI6QDLiQWY0FmI6s1W2ADL4cTXssVMyADL#tEDO30FLbFDOwwyNx0FLbJDNwwSL0kTXss1MwADLxUTNdxyWzYDMscTOy0FL]bRjMwwyM1cTXssFN4ADLxkjMz0FLbVDNwwSMwQTMdxyW2ADMsEDOyUTXsslN&2ADLzMjNx0FLbdjMwwCNxIDNdxyW3gDMsUjNwYTXssFO0ADL1gDM20FLblDM#wwyN1YTOdxyW5YDMskTN3MTXssVMwIDMskDMwgTXssVMwgDMskzN5YTXssVM*xQDMsEDMykDOdxyWxIDMwwSM2ADO40FLbFjM2ADLyATO5MTXdxiItFmcrVmc&iozeiUmbhJGblRmI6YWYsNXZ91XXsISZ4RnchNnI6snI4FEepNnRvJXbhRnI#6ICZ1JXY0l2buJCLiQ3bvxGdpBnRvJXbhRnI6ICdlFWbBRmdh5GdhdWZi0Xf" data-annotated="true"></div>
What type of encode was used and how can i decode this? Thanks!
Related
I'm analyzing a web, but I met a situation like this. I have tried to use base64 decoder to decode it but it did not work. What kind of encode method it used here?
<input type="hidden" id="ttt" value="aHR0LWtqZ3Vra3Vma3lkZktHTEtVRktIS0tndWZraGtobGtqZ2t1Z2tqdWd1eWZvdWd1Z3lpeWZrZmtmazg3NjQ1Nzd0OHlnaWo0amVyZnlnaXlrZGVydDQzNmU0N3l0aXVrdS0=cHM6LLWtqZ3Vra3Vma3lkZktHTEtVRktIS0tndWZraGtobGtqZ2t1Z2tqdWd1eWZvdWd1Z3lpeWZrZmtmazg3NjQ1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kZktHTEtVRktIS0tndWZraGtobGtqZ2t1Z2tqdWd1eWZvdWd1Z3lpeWZrZmtmazg3NjQ1Nzd0OHlnaWo0amVyZnlnaXlrZGVydDQzNmU0N3l0aXVrdS0=cGFnZQ==" />
I need to save data with html tag in Postman body request (raw/JSON) format via HTTP post method. When I tried it throws error as like the following image. How can I send data with html tag (What I see is what you get - WYSIWYG) in postman body?
You could encode the html into a base64 string and pass the string in postman.This can later be decoded to the original html once the request body is received in the codebase.
For the encoding and decoding you can use btoa and atob.A reference on this can be found in this link
An example of encoding the html string would look like this:
let htmlstring =`<html>
<body>
<p>This is test html</p>
</body>
</html>`
let htmlencodedString = btoa(htmlstring); // pass this htmlencodedString in the postman body
An example of decoding this would look like this:
let decodedString = atob(htmlencodedString); // this will give back the original html
There is no single quotes in JSON and there shouldn't be an ending comma ,
Enclose the value of content with double double quotes instead of single quotes and remove the comma after content value
The JSON seems to be not formatted correctly. Did you try to replace unexpected sequences like the \r before you POST the JSON again?
Double quotes " need escaping as \"
You can find and replace the value in your code editor. Like find all " and replace it with \"
Example:
"content": "<p><img class="img-responsive" src="the-url" alt="the alt" style="the styles"><p>"
should be
"content": "<p><img class=\"img-responsive\" src=\"the-url\" alt=\"the alt\" style=\"the styles\"><p>"
For example:
data-val-equalto="'MyProperty5' and 'MyProperty4' do not match."
Question: Why is the & character encoded again into & ('), instead of just outputting the character reference as is (') ?
The jquery.validate plugin seems to be parsing ' as '.
The problem doesn't seem to be in Razor, but with the code that generates the unobtrusive validation attributes, the following code:
<span title="#("'MyProperty5' and 'MyProperty4' do not match.")"></span>
... outputs correctly:
<span title="'MyProperty5' and 'MyProperty4' do not match."></span>
Found out that the problem is in ASP.NET MVC, there's a method called GetValidationAttributes that adds HTML-encoded values to a dictionary, and then the values are encoded again by TagBuilder. It would be good to know why they are doing this.
Try outputting using the Html.Raw method.
Otherwise, Razor does not assume you are trying to output encoded HTML and encodes it again.
Given
string text = `Bread & Breakfast`;
#text will be output as Bread & Breakfast because the & is HTML Encoded
#Html.Raw(text) will be output as "Bread & Breakfast"
UPDATE based on your update
I can't tell you why jQuery Validate works that way, but there's an old adage "if it hurts when you do X, stop doing X".
You don't really need to encode the single quote in your output HTML. Both of the following produce the same result:
<span title="'MyProperty5' and 'MyProperty4' do not match.">
Span With Encoded Title
</span>
<br />
<span title="'MyProperty5' and 'MyProperty4' do not match.">
Span With non-Encoded Title
</span>
This issue was fixed on MVC v4.
What is the format of a form sent in an http post request ?
I am trying an http client program and want to send a form in an http post request.
I tried :
< FORM METHOD=POST >
< INPUT name="name" value="chriss">
< /FORM >
is this correct ?
on the server side, when I try to get the value of name ( i use : form.getFirstValue("name")) I get null.
(I am using restlet as my API.)
Can anyone help me please
The body of the POST request sent by an HTML form is usually using the "application/x-www-form-urlencoded" media type.
If your client is also a Restlet client, you should be able to use the Form class, set the required values for each name/value pairs, and get the representation to send using getWebRepresentation().
Essentially, the body will look like this:
name=chriss
If you had more parameters, they would be separated by &.
(If you were sending files, you'd use the multipart/form-data encoding instead.)
An HTML reference will be helpful. There are plenty of good HTML books and online references.
<form method="post" action="/url/to/submit/to">
<input type="text" name="name" value="chriss">
</form>
I see that Firefox does NOT encode an URL like http://www.mysite.com/foo?bar=10/12/2010 when it sends a GET request. I know that URLs must be encoded, so I expected to see Firefox requesting http://www.mysite.com/foo?bar=10%2F12%2F2010 (/ = %2F). I inspected the GET requests using Wireshark.
Should the query string in the url be escaped?
I use WebHarvest and I see that when I ask it to download a page with the http directive, an URL like the one above is encoded like I expected (%2F instead of "/").
The / is allowed in plain in the query of a URI:
query = *( pchar / "/" / "?" )
Anything else must be encoded using the percent-encoding.
If, by escaped, you mean URL-encoded, the short answer is yes.
There are a number of characters that are normally encoded during URL encoding but could normally appear in the URL without problem.
But sometimes the potential problems are not always obvious. I would recommend URL encoding query arguments, and decoding them from your site. After all, if you decode too many times, that should not cause any problem.
Can't reproduce your problem.
<form>
<input type="hidden" name="bar" value="10/12/2010">
<input type="submit">
</form>
This displays the proper escape in address bar. Aren't you supplying this URL in an <a> element? Then you need to escape it in the HTML page yourself by either hardcoding it or utilizing the functions provided by the server side language.