Some characters not showing up

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

I've got a page calling in some HTML via AJAX. This HTML that I get has some weird characters in it like ’ and ½. This characters show up as ? in Firefox and little box things in IE and Opera. The page that calls in the HTML has the standard stuff at the top:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

I've had this problem many, many times, and after reading Megan's article I switched to a different charset hoping that it would work, but the browsers still can't display those characters.

The page validates and so does the HTML called in by the AJAX (but the HTML called in by the AJAX doesn't have a < head >, it's just you'd see between < body >).

Do you know what could be causing this?

teammatt3's picture

He has: 2,102 posts

Joined: Sep 2003

Once again, I figure it out right after I post...

All I had to do was change from this

<html xmlns="http://www.w3.org/1999/xhtml">

to this

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Well, the important thing is that you post up the answer after working it out. I wouldn't have known the answer to this otherwise. Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.