J^T: John Thywissen's personal pages

Character Encoding and End-of-Line Characters

Correct charter encoding and end-of-line characters for a variety of Web development related file types.

Thywissen, John A. Character Encoding and End-of-Line Characters [Web page]. Plano (TX): c2007 [revised 2007 Oct 20; cited 2014 Sep 16]. Available from: http://john.thywissen.org/encodings.html
File type File extension Character encoding End-of-line characters
Java source .java Platform default encoding (for example, MacRoman) LF (Unix convention)
CSS .css UTF-8
Put @charset "UTF-8"; at top
Note: changed in CSS 2.1, was ISO-8859-1
LF (Unix convention)
HTML .html use encoding spec'd in woo files
include charset=ISO-8859-1
ISO-8859-1 preferred (no Unicode) (UTF-8 for Unicode)
CR LF (Windows convention)
XHTML .html use encoding spec'd in woo files
include charset=
UTF-8 preferred
LF (Unix convention)
XML .xml use encoding spec'd in woo files
include charset=
UTF-8 preferred
LF (Unix convention)
.wod files use encoding spec'd in woo files LF (Unix convention)
.woo files Platform default encoding (MacRoman) LF (Unix convention)
.api files UTF-8 LF (Unix convention)
"Properties" files ISO-8859-1 LF (Unix convention)
.strings UTF-16 LF (Unix convention)
JavaScript .js Plain ASCII
(ISO-8859-1 if ASCII not available)
LF (Unix convention)