RE: [WSG] Article: MIME and Content Negotiation

2006-01-18 Thread Richard Ishida
Hello Karl,
 
Interesting series of articles.  For this one, there's quite a lot to be said, 
and fitting it all in in a way the novice can understand in progressive steps 
it is a bit of a challenge.  

Just a few thoughts

[1] "For text/html it is best to define the character encoding in the HTTP 
header rather than hard code  into your pages or templates."

I think the question of character encoding declarations is skimped a little.  
At the W3C we looked at best practises for character encoding declarations.  
You can find our conclusions at 
http://www.w3.org/International/tutorials/tutorial-char-enc/en/all.html#Slide0240

Note that HTTP isn't always the best way to go.  There are pros and cons, 
depending on the usage and the developer.
 
[2] The main thrust of this article seems to be how to use application/text+xml 
to allow for forward compatability.  I wondered whether it might be better to 
split the article into more general introductions to content negotiation, xml 
declaration, etc.  then discuss use of application/xml+xhtml, and in another 
article bring everything together with an example PHP application. Just an idea.

[3] "The XML Declaration is required for character sets other than UTF-8 and 
UTF-16"  

s/character sets/character encodings/

For example, utf-8 and utf-16 are both exactly the same character set, though 
different encodings (see 
http://www.w3.org/International/tutorials/tutorial-char-enc/en/slides/Slide0060.html
 )


[4] "You will need to ensure that all other character references are numeric in 
nature."  

It would be good to explain the reason you say this.

hth
RI



Richard Ishida
Internationalization Lead
W3C (World Wide Web Consortium)

http://www.w3.org/People/Ishida/
http://www.w3.org/International/
http://people.w3.org/rishida/blog/
http://www.flickr.com/photos/ishida/


 




From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Karl 
Dawson
Sent: 16 January 2006 09:21
To: wsg@webstandardsgroup.org
    Subject: [WSG] Article: MIME and Content Negotiation


Hi,

Apologies in advance if you see this cross-posted:

"From the Top" is a series of articles that I am publishing to 
concisely explain how and why to construct a high quality, web-standards 
compliant head section for a web page. The second article, just released, 
examines MIME and Content Negotiation.

http://www.thatstandardsguy.co.uk/2006/01/16/content-negotiation/

Comments, especially error-spotting and general "bravo" very welcome, 
it all helps with my work position.

Regards,
-- 
Karl Dawson
Crusader for Web Standards and Accessibility
http://www.thatstandardsguy.co.uk
-- 
Accessites Team Member - http://www.accessites.org/
-- 

"The power of the Web is in its universality. Access by everyone 
regardless of disability is an essential aspect." 
Tim Berners-Lee - W3C Director and inventor of the World Wide Web



**
The discussion list for  http://webstandardsgroup.org/

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



Re: [WSG] Article: MIME and Content Negotiation

2006-01-17 Thread Anders Nawroth



designer skrev:

So I made a simplified version of my opening page (removed counters 
and other impedimenta) and removed the meta tags.  All I got was 
Chinese and gobbledegook!  So I uploaded it to:


http://www.rhh.myzen.co.uk/rhh/gam/test.php

I was stunned to find that it works a treat when uploaded!  On my 
local machine I am using wampserver for testing.  Any ideas as to why 
this should occur?  Is it to do with utf-8?


Use
http://livehttpheaders.mozdev.org/
to check what http headers are really sent from the wampserver.


/AndersN
**
The discussion list for  http://webstandardsgroup.org/

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



Re: [WSG] Article: MIME and Content Negotiation

2006-01-17 Thread Lachlan Hunt

designer wrote:
So I made a simplified version of my opening page (removed counters and 
other impedimenta) and removed the meta tags.  All I got was Chinese and 
gobbledegook!  So I uploaded it to:


http://www.rhh.myzen.co.uk/rhh/gam/test.php


Did it look anything like this?
http://software.hixie.ch/utilities/cgi/content-type-proxy/content-type-proxy?uri=http%3A%2F%2Fwww.rhh.myzen.co.uk%2Frhh%2Fgam%2Ftest.php&type=text%2Fplain%3Bcharset%3DUTF-16

It could be that your testing server is sending UTF-16 (or some other 
incorrect encoding) for some strange reason.  The easiest way to find 
out is by using Mozilla or Firefox, go to Tools>Page Info... and look at 
the MIME type and encoding information listed in the dialog.


--
Lachlan Hunt
http://lachy.id.au/

**
The discussion list for  http://webstandardsgroup.org/

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



Re: [WSG] Article: MIME and Content Negotiation

2006-01-17 Thread designer

Hi Lachlan, Philippe, and all,

So I made a simplified version of my opening page (removed counters and 
other impedimenta) and removed the meta tags.  All I got was Chinese and 
gobbledegook!  So I uploaded it to:


http://www.rhh.myzen.co.uk/rhh/gam/test.php

I was stunned to find that it works a treat when uploaded!  On my local 
machine I am using wampserver for testing.  Any ideas as to why this 
should occur?  Is it to do with utf-8?


--
Best Regards,

Bob McClelland

Cornwall (UK)
www.gwelanmor-internet.co.uk



Lachlan Hunt wrote:

Can you please make up a small sample document that clearly 
demonstrates this issue occurring and post a URI so that we may see it.





**
The discussion list for  http://webstandardsgroup.org/

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



Re: [WSG] Article: MIME and Content Negotiation

2006-01-16 Thread Lachlan Hunt

designer wrote:
However, I remain confused in the particular case of the PHP approach.  
The PHP looks to see 
"if(stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml"))" and on 
that basis it describes the appropriate prolog, mimetype and charset. So 
the final three lines of the php code (where the action takes place :-)  
are:


   header("Content-Type: $mime;  charset=$charset");
   header("Vary: Accept");
   print $prolog_type;

One therefore assumes that the 'real http headers' ARE being used in 
this case.  However, if I do that I can only get Chinese unless I get 
PHP to echo the meta tag:


Can you please make up a small sample document that clearly demonstrates 
this issue occurring and post a URI so that we may see it.


--
Lachlan Hunt
http://lachy.id.au/

**
The discussion list for  http://webstandardsgroup.org/

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



Re: [WSG] Article: MIME and Content Negotiation

2006-01-16 Thread Philippe Wittenbergh


On 16 Jan 2006, at 11:53 pm, designer wrote:

However, I remain confused in the particular case of the PHP  
approach.  The PHP looks to see "if(stristr($_SERVER 
["HTTP_ACCEPT"],"application/xhtml+xml"))" and on that basis it  
describes the appropriate prolog, mimetype and charset. So the  
final three lines of the php code (where the action takes  
place :-)  are:


   header("Content-Type: $mime;  charset=$charset");
   header("Vary: Accept");
   print $prolog_type;


That sounds very weird. Either your browser is acting up or something  
is not properly configured, or your server is doing something odd on  
the way.


Is the $charset var set up correctly ? (near the top of the code)
It should read:

$charset = "utf-8";

Philippe
---
Philippe Wittenbergh



**
The discussion list for  http://webstandardsgroup.org/

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



Re: [WSG] Article: MIME and Content Negotiation

2006-01-16 Thread Lachlan Hunt

Paul Novitski wrote:

At 04:02 AM 1/16/2006, Lachlan Hunt wrote:
(The charset parameter is only really needed for text/* media types, 
for XML served with an application/* media type, the XML declaration 
is recommended for use instead which may be omitted for UTF-8 and UTF-16)

http://lachy.id.au/log/2006/01/content-type


For clarification, was your first clause above a sentence in its own right?

I assume you meant, "(The charset parameter is only really needed for 
text/* media types.  For XML served with an application/* media type...


Yes, that's correct.  It was just a typo.

**
The discussion list for  http://webstandardsgroup.org/

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



[WSG] Article: MIME and Content Negotiation

2006-01-16 Thread Simon Jessey



"Comments, especially error-spotting and general "bravo" very 
welcome"
 
One minor inaccuracy. The article 
written by Neil Crosby is based on an article I wrote in October of the previous 
year. Oddly enough, it was Russ Weakely who badgered me into writing it in the 
first place.
 
 Simon Jessey


Business Email: [EMAIL PROTECTED]
Personal Email: [EMAIL PROTECTED]
Business Site:  http://keystonewebsites.com/
Personal Site:  http://jessey.net/


Re: [WSG] Article: MIME and Content Negotiation

2006-01-16 Thread Paul Novitski

At 04:02 AM 1/16/2006, Lachlan Hunt wrote:
(The charset parameter is only really needed for text/* media types, 
for XML served with an application/* media type, the XML declaration 
is recommended for use instead which may be omitted for UTF-8 and UTF-16)

http://lachy.id.au/log/2006/01/content-type


For clarification, was your first clause above a sentence in its own right?

I assume you meant, "(The charset parameter is only really needed for 
text/* media types.  For XML served with an application/* media type, 
the XML declaration is recommended for use instead which may be 
omitted for UTF-8 and UTF-16)."


Thanks very much for the article, Lachlan.

Paul  


**
The discussion list for  http://webstandardsgroup.org/

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



Re: [WSG] Article: MIME and Content Negotiation

2006-01-16 Thread designer

Lachlan Hunt wrote:  [snip]

Did you read my article [1] which Rimantas referred you to?  That 
explains what you're supposed to do.  You need to use real HTTP 
headers, not the inferior meta element.  The end of that article links 
to another that actually explains how to set the charset parameter in 
the HTTP headers using various servers and server-side scripting 
languages [2].


Well Lachlan, not only did I read it, I printed it out and read it in 
bed at around 1.50am!  (now that's keen!)


However, I remain confused in the particular case of the PHP approach.  
The PHP looks to see 
"if(stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml"))" and on 
that basis it describes the appropriate prolog, mimetype and charset. So 
the final three lines of the php code (where the action takes place :-)  
are:


   header("Content-Type: $mime;  charset=$charset");
   header("Vary: Accept");
   print $prolog_type;

One therefore assumes that the 'real http headers' ARE being used in 
this case.  However, if I do that I can only get Chinese unless I get 
PHP to echo the meta tag:


  echo "content=\"application/xhtml+xml; charset=utf-8\" />";

  }
  else
  {
  echo"charset=utf-8\"/>";

  }
?>  

And I'm confused, because (if I've understood it properly) this should 
not be required?


--
Best Regards,

Bob McClelland

Cornwall (UK)
www.gwelanmor-internet.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
**



Re: [WSG] Article: MIME and Content Negotiation

2006-01-16 Thread Karl Dawson
Thanks for the feedback, I made a few amendments / corrections this morning including:xhtml-xml - D'oh! Got it right twice before :owell-formedness versus validation - Got it right once before ;-) (more coffee at proof-reading time)
On 16/01/06, Lachlan Hunt <[EMAIL PROTECTED]> wrote:
> # The XML Prolog is required for character sets other than UTF-8 and> UTF-16. This is declared on line 1 of your code in the format > version="1.0" encoding="yourChosenCharset" ?>
That's the XML declaration, which forms part of the XML Prolog.  The XMLProlog is always present and comprises the XML declaration, PIs and theDOCTYPE (although all of those parts are optional in XML 1.0)
Ahhh, thanks for the clarification. I should state here I guess that not only did this take all week to write, but it was (and always will be) a learning curve too. 
> # Only five named character entities are "safe": <, >, &,> " and '.On 4 are safe when using text/html, because ' is undefined in HTMLand is not supported by IE.  However, the article of mine that you
linked to does cover that issue so it's not a major problem.> Standard Generalized Markup Language (SGML) comments () hide everything - including style and script tags.
They're XML comments, which are based on SGML comments but still differin significant ways.  I have another article which covers this issue ingreat detail.I pulled that bullet-point because I'd gotten it muddled up. I'll read up your article and word it better in an update.
http://lachy.id.au/log/2005/05/script-comments
> # Stylesheets need to be referenced with an XML stylesheet> declaration.Wrong!  That's just one of the myths in the widely criticised Appendix C.> This is done by creating a fragment identifier,
Slightly wrong terminology, a fragment identifier only occurs in a URI(after the #) which references an ID or an anchor in an (X)HTML document.> for example id="myStyle" in each