Ivan said:
Unfortunaty, sometimes modifying someone's script isn't easy at
all.
If modifying the generating server-side script so that JSON or other
non-markup data formats are used is not an option, ISTM you are left
with the following alternatives:
1) The generated markup is a Valid X(HT)ML fragment served as
application/xhtml+xml or application/xml or text/xml
(in short: XML media types) and the target markup is
Valid XHTML served as such:
Use a client-side XML parser (built into MSXML and Gecko),
clone, and insert/replace.
2) The generated markup is a Valid HTML fragment served as such:
a) Convert it to XHTML client-side, use an XML parser there,
clone, and insert/replace.
b) Write a client-side HTML parser that builds the subtree
(It is not that hard, using RegExp in a while-loop, and
observing a few DTD rules while creating the DOM objects),
then insert/replace the subtree.
c) Use the `innerHTML' property (with its known side effects).
Also, there's always the possibility to do most of the work server-side
using transparent proxying.
Anyway, I found some more info about a problem after some testing. It
seems that newlines are not causing the problems. IE has a problem
with AJAX calls
There is no such thing as an "AJAX call".
I thought they wouldn't be useful in this case.
Rule of thumb: In order to receive help you should give other people as much
*information* about the problem as possible to increase the chance that this
information contains the parts that these people need in order to help you.
See also *especially* (but not exclusively)
<
http://www.catb.org/~esr/faqs/smart-questions.html#beprecise> and the
following section.
BTW: Asking "What is so not smart in my question?" after being pointed to
a tutorial on how to ask smart questions is essentially asking a stupid
question
when using UTF-8 encoding (and non ASCII are present).
When I put different encoding, everything works well (except non ASCII
characters aren't encoded properly, but I can fix that).
You should LART the person responding with such junk instead. There needs
to be a
Content-Type: ...; charset=UTF-8
header in the response message if the message body contains characters in
UTF-8 encoding. Everything else must result in guesswork on part of the
user agent (here probably ISO-8859-1, as your "non ASCII characters" are
instead Unicode characters beyond code point U+007F), so you really cannot
blame IE/MSHTML then.
Incidentally, you would not have had that problem with XML (read: an XHTML
fragment) as UTF-8 is one of the default encodings there. Proxying also can
work around that in case the other person acts not as responsible as should
be required.
PointedEars