Chinese Page - Encoding issue / External CSS link issue


Here is my HTML code:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<link rel="stylesheet" type="text/css" href="/css/site.css" lang="en" content="text/html; charset=utf-8" /> 







This works perfectly in showing my Chinese and Page content, but it doesn’t find my CSS file. The file is definitely there as when I click the link in FireFox source code it shows me a bunch of Chinese language.

Basically, how should I refer to an external CSS link that is in English?

Thank you

When the file is in a folder called css your link should read:

<link rel="stylesheet" type="text/css" href="css/site.css" lang="en" content="text/html; charset=utf-8" />

Note I removed the / in front of the css folder

Thanks for the quick reply.

That doesn’t seem to fix it however. It still shows the CSS file in ‘Chinese’.

You have several syntax errors possibly you could try the following since I assume it is supposed to be a document in Chinese as the primary language.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" lang='zh-hans' xml:lang='zh-hans'>
    <link rel="stylesheet" href="css/site.css" type="text/css" />
    <meta http-equiv="Content-Type" content=
    "text/html; charset=UTF-8" />

When you say it still has the CSS file in Chinese; do you mean when you open the CSS file it contains Chinese characters? If so then it will remain as such because it was written in Chinese.

Hi. Thanks for the response :slight_smile:

Actually there’s only certain elements that are going to be in Chinese.

Like the <title> value, anything inside the <p> and <li> items and the <h1> value in the body.

Also, my computer always seems to change the words into square blocks. I’ve no idea why.

Thanks for your patience with this. Appreciate the help :slight_smile:

So actually you mean you have an English site with mixed Chinese phrases or words occurring. The TITLE attribute may be a “browser issue” as that tends to render differently anyway so don’t worry about that too much.

However, the content within the page can just take the attribute values of xml:lang and lang respectively.

So rather than set attributes on the P element if there are going to be several paragraphs you could wrap it within a DIV for example <div lang=“zh-hans” xml:lang=“zh-hans”><p>Some Simplified Chinese text[…]</p></div> if it were a LI obviously set the language on that instead.

It would probably be best to obviously save your file as UTF-8 the reason you might not be seeing the Chinese Glyphs can be down to character encoding and what fonts and Language packs you have installed on your computer.

With the CSS you want to choose fonts that are suitable and have good Unicode support.

Many thanks for your sterling reply sir.

Yes, it’s probably fair to describe it as English and Chinese. For the most part it’ll be Chinese on the page.

Aaaaah, that’s starting to make sense now regarding not seeing the Glyphs. In work(Vista) I see them fine but not at home(XP Pro).

Is there an easy workaround so I can install language packs for my computer?

Thanks once more.

Your computer’s Control Panel will have a Languages section. I think it’s fairly self-evident once you get there.

Failing that, a quick google search reveals the following guide:
Installing East Asian Language Support Under Windows XP

Thanks for your reply. Literally just looked it up after asking here :slight_smile: I’ll need to dig out my XP disc.

Thanks again for your help people