When the “Refer to encoding declaration in document” option is turned on in the Format settings pane, CotEditor reads the following types of encoding declarations (if present) — charset=, encoding=, @charset, encoding: and coding: — when opening a file. If written properly, these declarations will be used to determine the file’s text encoding.
A declaration can be anywhere in the document, the one either in the comment area or in a plain sentence is detected. When you want to use a phrase such as “charset=UTF-8” even though your document’s encoding is not UTF-8, you need to put an actual encoding declaration prior to the phrase, or, turn off the “Refer to encoding declaration in document” option in the Format settings.
charset” or “encoding.”charset=” or “encoding=” can be without double-quotes (") around.charset="Shift_JIS"), CotEditor chooses the prioritized one (the upper one in the encoding list) between “Japanese (Shift JIS)” and “Japanese (Shift JIS X0213).”