Welcome to WebmasterWorld Guest from 54.167.0.111

Forum Moderators: incrediBILL

Message Too Old, No Replies

HTML language specification

need to clarify what to use

     

Gus_R

2:52 pm on Jul 24, 2003 (gmt 0)

10+ Year Member



Hello, this is my first thread, so please understand ...

I run a site with two language versions, english at the main domain & spanish which are pointed with a subdomain. Every page has a line:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

and:

<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

this is for english content, for the subdomain:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

and:

<meta http-equiv="Content-Language" content="es">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

this for the spanish one.

My doubt is if it's ok, and second, if spiders get confused with this statements.
Should I remove this code and let them choose?

Gus

marek

3:11 pm on Jul 24, 2003 (gmt 0)

10+ Year Member



Does it validate? If yes, then it is ok.

Gus_R

3:33 pm on Jul 24, 2003 (gmt 0)

10+ Year Member



Didn't validate for other minor things I don't fix because I'm short with time.

I will check it, thanks.

universalis

5:57 pm on Jul 24, 2003 (gmt 0)

10+ Year Member



Try the following template - if the new DOCTYPE causes problems, you can remove the w3.org url part to force newer browsers into quirks mode rather than standards-compliance mode.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html lang="en">

<head>

<title>HTML 4.01 Transitional template</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body>

... content here ...

</body>
</html>

Note that having a DOCTYPE is obligatory, as is defining the content language and the charset, so don't remove them, or your pages will no longer be valid. Using the meta tag to define the language is fine too, but my version is shorter!

Gus_R

6:41 pm on Jul 24, 2003 (gmt 0)

10+ Year Member



universalis, can I exchange:

<html lang="en">

with:

<html lang="es">

for the spanish version? or DOCTYPE must be replaced too?

marek

7:30 pm on Jul 24, 2003 (gmt 0)

10+ Year Member



Gus, you can (should) replace <html lang="en"> with <html lang="es"> in the Spanish version.

Universalis,

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

should be before the TITLE tag.

g1smd

7:52 pm on Jul 24, 2003 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The DOCTYPE tells the Browser which version of HTML you are using. Change 4.0 to 4.01 in your files.

The Content-Type meta tag or HTML lang attribute tells spiders and translation tools what human language the content is in.

universalis

8:04 pm on Jul 24, 2003 (gmt 0)

10+ Year Member



<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

should be before the TITLE tag.

Should it? Why? Why does it still validate when I put the title first (better for SEO)? Perhaps I'm missing something here...

tedster

8:39 pm on Jul 24, 2003 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I think there's some confusion between the DTD (which should precede even the <html> tag) and the Content-Type meta tag, which like all meta tags may certainly follow the Title Tag.

W3C Reference:
Gobal Structure of an HTML Document [w3.org]

pageoneresults

8:43 pm on Jul 24, 2003 (gmt 0)

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Try the following template - if the new DOCTYPE causes problems, you can remove the w3.org url part to force newer browsers into quirks mode rather than standards-compliance mode.

You know, I used to do this back in the beginning of my career in validation. It was recommended that I remove the DTD reference due to a problem I was having with a top margin in IE. Removing the DTD reference cleared it up.

But, you know what, I found out that was not the problem. It was something I had in my CSS that was causing the issue. When you force a browser into quirks mode, you are defeating the sole purpose of validation and using the DOCTYPE to begin with.

I no longer recommend that you use shortened DOCTYPEs. Always use the full reference. If you run into problems at the browser level, it is not the browser or the DOCTYPE, it is your css or html that is causing the problem.

pageoneresults

8:49 pm on Jul 24, 2003 (gmt 0)

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The value of the Content attribute of the META element is the same as the value of the Content-Language header in HTTP; i.e, a comma-separated list of language codes. For example: <meta http-equiv="content-language" content="fr,en">

From the W3C - Primary Language in HTML [w3.org]

The reason for recommending META as opposed to the HTML element with the lang attribute are: N-lingual document could be specified. For example, a bilingual French/Spanish document can be specified. The language(s) would be transmitted in the Content-Language field of HTTP header.

g1smd

9:34 pm on Jul 24, 2003 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

should be before the TITLE tag.

I have had several people write to me to tell me that for some websites, mainly those using languages where the use of that language requires downloading extra character set support for the browser, that if the title was first then the title displayed at the top of the browser window was corrupted, but if the title was second then it displayed OK. One of those concerned characters in Chinese. This may be a browser issue/bug rather than to do with official specifications. I haven't tried replicating the alleged behaviour.

Gus_R

12:41 am on Jul 25, 2003 (gmt 0)

10+ Year Member



Thank you for replies.

Gus

jbinbpt

12:51 am on Jul 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi .. I'm curious where the charset=windows-1252 came from? It came up in this thread earlier today .. [webmasterworld.com...]

Gus_R

1:43 am on Jul 25, 2003 (gmt 0)

10+ Year Member



I took charset=windows-1252 from msdn one year ago when I researched the theme. Anyway I'll change the pages.

[edit] bad typing [/edit]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month