homepage Welcome to WebmasterWorld Guest from 54.204.249.184
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
HTML language specification
need to clarify what to use
Gus_R




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

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




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

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

Gus_R




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

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

I will check it, thanks.

universalis




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

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




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

universalis, can I exchange:

<html lang="en">

with:

<html lang="es">

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

marek




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

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




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

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




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

<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




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

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




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

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




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

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




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

<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




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

Thank you for replies.

Gus

jbinbpt




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

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

Gus_R




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

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]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved