You need both because the language of the page and the encoding of the
characters in the document are different things.
UTF8 does not tell you which language you're using, and the language
attributes to not exist for the purpose of rendering characters
correctly.

A page in UTF-8 could be in any language, it doesn't tell you which.
But the language attribute(s) are used for other things. Since you can
select them with CSS, a web browser can apply regionalised quotation
marks to blocks of a document if you've declared the langauge.  A
screen reader will use different libraries to read different
languages, too. There are a variety of 'beyond the browser' uses for
the attribute.

For further reference: You also use both "lang" and "xml:lang" in
XHTML transitional for backward compatibility with HTML4, whilst in
strict mode "xml:lang" is all you need.

In your case, since the page is mostly in English I would have
lang="en" in the <html> element, and as you suggest, put lang="zn" in
the relevent form elements or parent containers as necessary.

Ben

On 6/2/05, Vaska. WSG <[EMAIL PROTECTED]> wrote:
> It's for a multilanguage site and base language will be English.
> Everything on the form will be English except the actual input
> (textarea).  Would it hurt anything if I just kept the lang declaration
> as EN in the header?  Or, since the input will be Chinese should it be
> ZN?  Or, do I need to be more specific and delcare lang=ZN on the
> textarea itself?
> 
> I was wondering though...since it's ALL utf-8 it might not be necessary
> to declare lang=whatever at all?
> 
> Out of curiousity, I'm not sure why we need to declare lang and
> xml:lang since utf-8 (I believe) is all we really need?
> 
> 
> On Jun 2, 2005, at 4:21 PM, Ben Ward wrote:
> 
> > The language in your html element should be the language of the page.
> > If you have a section of the page (be that a parapraph, form,
> > anything) which uses a different language then you can add a lang and
> > xml:lang attribute to that as well. HTML is generally rather good at
> > doing multi-lingual documents.
> >
> > I could do this on a page (this is condensed down and is missing some
> > attributes, but I just want to show the xml:lang/lang behaviour):
> >
> > <html xml:lang="en-gb">
> > <!-- the page is in English -->
> >
> > <head></head>
> > <body>
> >
> > <form xml:lang="fr">
> >   <!-- this form is in french -->
> > </form>
> >
> > <!-- outside of the form, the language is still English -->
> > </body>
> > </html>
> >
> > The language declaration doesn't restrict the characters you can use
> > in forms, regardless. So you don't need to add a language attribute to
> > your sub-elements unless you are explicitly requiring Chinese input.
> > Obviously if it's an all chinese site then it would make sense to
> > change the language value in the <html> element itself.
> >
> > Ben
> > ******************************************************
> > The discussion list for  http://webstandardsgroup.org/
> >
> >  See http://webstandardsgroup.org/mail/guidelines.cfm
> >  for some hints on posting to the list & getting help
> > ******************************************************
> >
> >
> >
> 
> ******************************************************
> The discussion list for  http://webstandardsgroup.org/
> 
>  See http://webstandardsgroup.org/mail/guidelines.cfm
>  for some hints on posting to the list & getting help
> ******************************************************
> 
> 


-- 
http://www.ben-ward.co.uk
******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

Reply via email to