Forum Moderators: open

Message Too Old, No Replies

Problem with Japanese UTF-8 characters

Internet Explorer problem (FF, Opera OK)

         

craig1972

12:49 pm on Jul 10, 2005 (gmt 0)

10+ Year Member



Hi,

My page uses UTF-8 encoding. It's in Japanese.

Both FF and Opera automatically recognize that it's UTF-8 and show it fine. Even IE shows it fine if I specifically choose the encoding as UTF-8.

But most Japanese people have their computers set to "Shift_JIS", and in IE, when this is set, nothing shows up on the page. It's a blank page.

Any idea if I can include some in my HTML to make sure the browser changes the encoding to UTF-8? It's a PHP page so I can also send some header if that will help.

I already have these lines:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//JP" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="jp">
<head><title>ƒ‰ƒCƒt</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
....

Thanks for any ideas!

Glamba

4:46 pm on Jul 10, 2005 (gmt 0)

10+ Year Member



Have you tried to manipulate the HTTP mime-header?

Content-Type: text/html; charset=UTF-8

As an alternative you could try to use numeric HTML enteties.

<title>&#x30e9;&#x30a4;&#x30d5;</title>

bill

1:34 am on Jul 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



First, your DTD is incorrect. The correct DocType for XHTML 1.1 would be:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//[b]EN[/b]" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

Then, you've incorrectly declared the language of the page. JP is the country code for Japan. The language code for Japanese is JA. Something like this would be better:

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

Next, you might want to throw in the following to set the language in your meta tags:

<meta http-equiv="content-language" content="ja"> 
<meta name="language" content="ja">

I'd suggest being very careful with XHTML 1.1, in fact I would suggest not using it at all. You would get a lot more flexibility and cross browser compatibility with XHTML 1.0, particularly if you use the Transitional DTD.