3

I dont know why on earth jquery html() is doing this, but after i do

$('html').html()

i get "&copy" automatically converted to ©

anyway to avoid this? I need to dump the html of the page using javascript and dont need this useless conversions that are screwing up the html.

2 Answers 2

4

This really isn't the jQuery, or even JavaScript for that matter.

The browser will hold its own normalised representation of the underlying DOM. It will bear a close resemblence the the document itself, but character decoding (like the above) will be preserved.

Have a read of the following:

http://www.brainjar.com/dhtml/intro/

http://bytes.com/topic/javascript/answers/146257-body-innerhtml-issue

I'm afraid there is no way around this as far as I am aware.

Sign up to request clarification or add additional context in comments.

2 Comments

;( funny that firebug gets it right (e.g. without decoding it) do u know any other library/function that can dump the html of a page the "right" way?
Browsers don't keep the original source around. You'd have to use XHR or similar to re-request the page from the server.
0

jQuery should not. check what you really get using in FF firebug.

console.log($('html').html());

3 Comments

it shouldnt but it is. checked using log, dumping to file, etc.
you can file a bug report. bugs.jquery.com, but I guess @James Wiseman has a point here.
take a look at this post as well. stackoverflow.com/questions/4162270/…

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.