Editing configuration/Manual editing

From MozillaZine Knowledge Base
Jump to navigationJump to search
up to Editing configuration

If you choose to edit configuration files using your own text editor, you should bear the following points in mind.

Editor settings

To edit configuration files, you might need to check your text editor's settings so that your editor saves files using the correct file type and character encoding.

File type

Ensure that your editor saves plain text files.

Some editors can only save plain text files. These editors have no setting for the type of file.

Some editors can save various types of file. In this case, ensure that your editor saves configuration files as plain text (and preferably with Unix line endings).

Some editors recognize file names ending in .css and .js as CSS and JavaScript files respectively. These editors automatically save these files as plain text.

Character encoding

Configuration files use the UTF-8 character encoding (also known as character set or charset), but you do not always need to use a text editor that supports UTF-8.

For most purposes you only need to use basic English letters and symbols (ASCII) in your configuration files. In these cases, you can use almost any character encoding except Unicode. If your text editor does not have any setting for character encoding, then you can probably use it for ASCII characters.

For some purposes you need to type accents or other characters that are not ASCII. If your text editor is set to use UTF-8, then simply type the characters that you need.

If your editor does not support UTF-8, or if you cannot type the special characters that you need, then encode each special character using its hexadecimal Unicode representation. In .css files, use a backslash followed by hexadecimal digits. In .js files, use \u followed by exactly four hexadecimal digits.

For example, you can encode an information sign followed by a non-breaking space like this:

In userContent.css:

:link:before {content: "\2139\a0";}

In user.js:

user_pref("mailnews.reply_header_ondate", "\u2139\u00a0 On %s");

Checking your editor

To check your text editor, create a plain text file named test.txt. In the file, type some of the accents and special characters that you need. Save the file somewhere on your computer.

Open the file in your web browser. For example, in Firefox choose File – Open File... and select the file, or drag the file's icon and drop it in Firefox.

Set your browser's character encoding to UTF-8. For example, in Firefox choose View – Character Encoding – Unicode (UTF-8). Check that your browser displays the file correctly with this setting.

See Also

External Links

  • ChromEdit Plus add-on. It's a replacement for the outdated ChromEdit add-on. It's only been tested on XP and Ubuntu, and dropped support for chrome customization using userChrome.js.