July 11, 2003

encoding jig, java style

i suppose i shouldn't complain so much about cf i18n folks not quite getting on board the unicode 747. even in the java world, a world created from the ground up in unicode, many people are still having problems. a quick cruise thru the java i18n forums shows even more encoding misery than i normally see in the cf forums. that got me to thinking about tatooing "JUU" (just-use-unicode) on my forehead, but my wife suggested that wouldn't go over big w/her and the kids ;-) so as not to be a totally valuless blog posting: if you ever need to declare the encoding of an external CSS style sheet, according to the CSS2 Specification, you can use the "@charset at-rule". in your unicode CSS you would have something like @charset "UTF=8"; as the very first line in the file. note that this won't work for embedded styles as these share the encoding of the webpage. browsers are supposed to interpret a web page's encoding in the following order:
  1. HTTP "charset" parameter in a "Content-Type" field (which mx ignores btw)
  2. the @charset at-rule
  3. mechanisms of the language of the referencing document (e.g., in HTML, the "charset" attribute of the LINK element)
so now you know.


Post a Comment

<< Home