Discussion:
jQuery AJAX load and encoding/charset problems
Jesse Klaasse
18 years ago
Permalink
I have already spent hours and hours on the following problem. I am using
jQuery's AJAX load method in order to put a portlet in a DIV. The portlet
url is:
http://www.bam.nl/baminternet/baminternet/test/test_jQueryAjax/actueel.jsp
http://www.bam.nl/baminternet/baminternet/test/test_jQueryAjax/actueel.jsp



Which is showing fine when called directly. However, when using AJAX to load
the portlet into a DIV, this is the result:
http://www.bam.nl/baminternet/baminternet/test/test_jQueryAjax/ajax_encoding_test.jsp
http://www.bam.nl/baminternet/baminternet/test/test_jQueryAjax/ajax_encoding_test.jsp



As you probably can see, there seems to be some encoding/charset problem
here. We are using the "ISO-8859-1" charset all over the website, except for
the news portlet, which uses "ISO-8859-15" in order to support special
Word-characters like euro signs, long dashes and so forth.



I have tried to remove and put charset specifications everywhere, but
nothing seems to help. Does anyone have a suggestion how to fix this?



Thank you all very much in advance! Kind regards, Jesse Klaasse
--
View this message in context: http://www.nabble.com/jQuery-AJAX-load-and-encoding-charset-problems-tf4669662s27240.html#a13339398
Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Dan G. Switzer, II
18 years ago
Permalink
Jesse,
Post by Jesse Klaasse
I have already spent hours and hours on the following problem. I am using
jQuery's AJAX load method in order to put a portlet in a DIV. The portlet
http://www.bam.nl/baminternet/baminternet/test/test_jQueryAjax/actueel.jsp
http://www.bam.nl/baminternet/baminternet/test/test_jQueryAjax/actueel.jsp
One thing I noticed quickly is this page is a full HTML that includes <html>
and <body> tags. If you're loading HTML fragments into a DIV, you shouldn't
load a fully qualified HTML page--you should only load the content that
would be between the <body> tags.

Having multiple html and body tags can sometimes do all sorts of strange
things.

-Dan
Jesse Klaasse
18 years ago
Permalink
Dan, I have removed the HTML and body tags now, but unfortunately this
doesn't seem to help. Any other ideas?

-----Original Message-----
One thing I noticed quickly is this page is a full HTML that includes
<html> and <body> tags. If you're loading HTML fragments into a DIV, you
shouldn't load a fully qualified HTML page--you should only load the
content that would be between the <body> tags.

Having multiple html and body tags can sometimes do all sorts of strange
things.

-Dan
Brandnew
17 years ago
Permalink
I have exactly the same problem... And didn't find yet an answer... I
have all sort of crazy characters... The "é", "è" and all that stuffs,
they make horrible things.

Even if on my PHP page which I load, I put &eacute; or &eagrave;

If someone can answer both of our problems, would be great !
Post by Jesse Klaasse
Dan, I have removed the HTML and body tags now, but unfortunately this
doesn't seem to help. Any other ideas?
-----Original Message-----
One thing I noticed quickly is this page is a full HTML that includes
<html> and <body> tags. If you're loading HTML fragments into a DIV, you
shouldn't load a fully qualified HTML page--you should only load the
content that would be between the <body> tags.
Having multiple html and body tags can sometimes do all sorts of strange
things.
-Dan
jjyepez
17 years ago
Permalink
I don't know if the problem you both guys are having has to do exactly
with this, but this is what I suggest to you:

Add the following line at the very top of your script <- the script
you are requesting through AJAX.

header('Content-Type: text/html; charset=windows-1252');

Use the right charset code according to your country or alphabet
insted of "windows-1252".
I'm from Venezuela, where language is latin-american and
"windows-1252" works as expected, so, that's it.

I hope this help.

Best Regards.

Julio J.
Ccs - Venezuela
...
Gregor
17 years ago
Permalink
hello;

i had exactly the same problem. i've been so desperate that i wanted
to replace all of our special characters with UTF8 character codes.
well the header() option that jjyepez suggested works as charm!

thank you =)
...
Loading...