Help:Special characters
Systems for character encoding
editEach MediaWiki project uses either of the following two systems for character encoding:
- ISO-8859-1 - The Wikipedias in English, Dutch, Danish, and Swedish.
- one byte per character
- special characters that are not available in the limited character set are stored in the form of a multi-character code; there are usually two or three equivalent representations, e.g. for the character € the named character reference € and the decimal character reference € and the hexadecimal character reference €. The edit box shows the code, the webpage the character; unavailable characters which are copied into the edit box are first displayed as character, and automatically converted to their decimal codes on Preview or Save.
- the most common special characters, such as é, are in the character set, so code like é, although allowed, is not needed.
- Unicode (UTF-8) - The other projects: the non-western Wikipedias, many western Wikipedias including French, German, and Spanish (but not the largest), the Wiktionaries, Meta, Wikibooks, Wikisource, Wikiquote
- a variable number of bytes per character
- special characters, including CJK characters, can be treated like normal ones; not only the webpage, but also the edit box shows the character; in addition it is possible to use the multi-character codes; they are not automatically converted in the edit box.
Note that Special:Export, at least within the English Wikipedia, exports using UTF-8 even though the database is encoded in ISO 8859-1.
To find out which character set applies in a project, copy e.g. ☉ (this should be a circle with a dot inside) into the edit box; if it is still there after pressing Preview, the project uses UTF-8. On other projects it should be converted to ☉ in the edit box and show as ☉ in the page (but see also below on browser capabilities).
Also, in the HTML source of a page, near the top there is either
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
or
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
. The Esperanto Wikipedia uses UTF-8, but a character like Ŝ is in the edit box automatically converted into the alternative notation Sx, because in some browsers it may not display in the edit box, even if it displays in the webpage, and Sx, whether resulting from this conversion or just typed, is rendered as Ŝ.
Plans to convert all languages to UTF-8? Problems with UTF-8?
Ways to enter special characters
editMany characters not in the repertoire of standard ASCII will be useful—even necessary—for wiki pages, especially for foreign language textbooks. This page contains recommendations for which characters are safe to use and how to use them. There are three ways to enter a non-ASCII character into the wikitext:
- Enter the character directly from a foreign keyboard, or by cut and paste from a "character map" type application, or by some special means provided by the operating system or text editing application. The web server should then be configured to announce which 8-bit character set is being used.
- Use an HTML named character entity reference like
à
. This is unambiguous even when the server does not announce the use of any special character set, and even when the character does not display properly on some browsers. However it may cause difficulties with searches (see below). - Use an HTML numeric character entity reference like
¡
. Unfortunately some old browsers incorrectly interpret these as references to the native character set. It is, however, the only way to enter Unicode values for which there is no named entity, such as the Turkish letters. Note that because the code points 128 to 159 are unused in both ISO-8859-1 (??? 128-159 are used in ISO-8859-1, but not ISO 8859-1) and Unicode, character references in that range such asƒ
are illegal and ambiguous, though they are commonly used by many web sites.
Generally speaking, Western European languages such as Spanish, French, and German pose few problems. For specific details about other languages, see: Turkish. (More will be added to this list as contributors in other languages appear.)
For the purpose of searching, a word with a special character can best be written using the first method. If the second method is used a word like Odiliënberg can only be found by searching for Odili, euml and|or nberg; this is actually a bug that should be fixed—the entities should be folded into their raw character equivalents so all searches on them are equivalent. See also Help:Searching.
ISO-8859-1 Characters
editThe following extended ASCII characters are safe for use in all Wiki pages. The table below shows the character itself, lists the code for each character in hexadecimal and decimal, shows the HTML entity name, and gives the common name of the character.
Literal | Hex | Dec | Entity | Character |
---|---|---|---|---|
00A0 | 0160 | | no-break space | |
¡ | 00A1 | 0161 | ¡ | inverted exclamation |
¢ | 00A2 | 0162 | ¢ | cent sign |
£ | 00A3 | 0163 | £ | pound sign |
¤ | 00A4 | 0164 | ¤ | intl. currency sign |
¥ | 00A5 | 0165 | ¥ | yen sign |
§ | 00A7 | 0167 | § | section sign |
¨ | 00A8 | 0168 | ¨ | diaeresis (umlaut) |
© | 00A9 | 0169 | © | copyright sign |
ª | 00AA | 0170 | ª | feminine ordinal |
« | 00AB | 0171 | « | left double-angle quote |
¬ | 00AC | 0172 | ¬ | not sign |
® | 00AE | 0174 | ® | registered trademark sign |
¯ | 00AF | 0175 | ¯ | macron |
° | 00B0 | 0176 | ° | degree sign |
± | 00B1 | 0177 | ± | plus-minus sign |
´ | 00B4 | 0180 | ´ | acute accent |
µ | 00B5 | 0181 | µ | micro sign |
¶ | 00B6 | 0182 | ¶ | pilcrow (paragraph) sign |
· | 00B7 | 0183 | · | middle dot (Georgian comma) |
¸ | 00B8 | 0184 | ¸ | cedilla |
º | 00BA | 0186 | º | masculine ordinal |
» | 00BB | 0187 | » | right double-angle quote |
¿ | 00BF | 0191 | ¿ | inverted question |
À | 00C0 | 0192 | À | A grave |
Á | 00C1 | 0193 | Á | A acute |
 | 00C2 | 0194 |  | A circumflex |
à | 00C3 | 0195 | à | A tilde |
Ä | 00C4 | 0196 | Ä | A diaeresis |
Å | 00C5 | 0197 | Å | A ring |
Æ | 00C6 | 0198 | Æ | AE ligature |
Ç | 00C7 | 0199 | Ç | C cedilla |
È | 00C8 | 0200 | È | E grave |
É | 00C9 | 0201 | É | E acute |
Ê | 00CA | 0202 | Ê | E circumflex |
Ë | 00CB | 0203 | Ë | E diaeresis |
Ì | 00CC | 0204 | Ì | I grave |
Í | 00CD | 0205 | Í | I acute |
Î | 00CE | 0206 | Î | I circumflex |
Ï | 00CF | 0207 | Ï | I diaeresis |
Ñ | 00D1 | 0209 | Ñ | N tilde |
Ò | 00D2 | 0210 | Ò | O grave |
Ó | 00D3 | 0211 | Ó | O acute |
Ô | 00D4 | 0212 | Ô | O circumflex |
Õ | 00D5 | 0213 | Õ | O tilde |
Ö | 00D6 | 0214 | Ö | O diaeresis |
Ø | 00D8 | 0216 | Ø | O stroke |
Ù | 00D9 | 0217 | Ù | U grave |
Ú | 00DA | 0218 | Ú | U acute |
Û | 00DB | 0219 | Û | U circumflex |
Ü | 00DC | 0220 | Ü | U diaeresis |
ß | 00DF | 0223 | ß | sharp s (ess-zed) |
à | 00E0 | 0224 | à | a grave |
á | 00E1 | 0225 | á | a acute |
â | 00E2 | 0226 | â | a circumflex |
ã | 00E3 | 0227 | ã | a tilde |
ä | 00E4 | 0228 | ä | a diaeresis |
å | 00E5 | 0229 | å | a ring |
æ | 00E6 | 0230 | æ | ae ligature |
ç | 00E7 | 0231 | ç | c cedilla |
è | 00E8 | 0232 | è | e grave |
é | 00E9 | 0233 | é | e acute |
ê | 00EA | 0234 | ê | e circumflex |
ë | 00EB | 0235 | ë | e diaeresis |
ì | 00EC | 0236 | ì | i grave |
í | 00ED | 0237 | í | i acute |
î | 00EE | 0238 | î | i circumflex |
ï | 00EF | 0239 | ï | i diaeresis |
ñ | 00F1 | 0241 | ñ | n tilde |
ò | 00F2 | 0242 | ò | o grave |
ó | 00F3 | 0243 | ó | o acute |
ô | 00F4 | 0244 | ô | o circumflex |
õ | 00F5 | 0245 | õ | o tilde |
ö | 00F6 | 0246 | ö | o diaeresis |
÷ | 00F7 | 0247 | ÷ | divide sign |
ø | 00F8 | 0248 | ø | o stroke |
ù | 00F9 | 0249 | ù | u grave |
ú | 00FA | 0250 | ú | u acute |
û | 00FB | 0251 | û | u circumflex |
ü | 00FC | 0252 | ü | u diaeresis |
ÿ | 00FF | 0255 | ÿ | y diaeresis |
These characters are a subset of the most common extended ASCII character set in use on the Internet, ISO 8859-1. MediaWiki pages are identified by the server as containing ISO-8859-1 text. The characters above are a subset selected to improve compatibility with other machines.
For example, the Apple Macintosh is in common use on the Internet, is not limited to any specific language, and its native character set (which is not ISO-8859-1) contains many of the common international characters. Many Macintosh browsers will correctly translate ISO text into the native character set, as long as the characters used are available. So the table above is the subset of ISO-8859-1 characters that are also available on the native Macintosh character set. (This is the situation up through Mac OS 9.x, at any rate; Mac OS X appears to use Unicode as its native encoding.)
Microsoft Windows standard code page 1252 set is a superset of ISO-8859-1, so these characters will be readable as is on Windows machines. The most common Latin character sets other than ISO-8859-1 are MS-DOS (pre-Windows) code page 437, Macintosh Roman, and other ISO sets such as ISO-8859-2. The number of pre-Windows MS-DOS machines with web browsers is small and they are often dedicated-purpose machines that wouldn't be using MediaWiki anyway, so it is reasonably safe to sacrifice compatibility with them for the sake of needed foreign characters. Other ISO sets are generally intended to be read by other browsers using those same sets in the same country, and so those pages should use a language-specific set.
These characters can be entered either as HTML named character entity references such as à, directly from foreign keyboards, or with whatever facilities are available to the Wiki author for entering these characters. For example, Wiki authors using Windows machines can enter these by holding down the Alt key while typing the 4-digit decimal code of the character on the numeric pad of the keyboard. It is important that all 4 digits (including the leading 0) be typed; typing a 3-digit code will enter characters from the obsolete code page 437. Wiki authors using Macintosh machines should take care to either use special facilities to enter these in ISO-8859-1 format rather than with the native character set, or else use HTML named character entity references. Note that some Windows users may have trouble with versions of Microsoft Internet Explorer that use "Alt-Left-Arrow" and "Alt-Right-Arrow" for page movement. These will interfere with entering codes that contain the digits 4 and 6. Use HTML named character entity references in this case.
The characters from the table above can be used directly as 8-bit characters in all Wiki pages, and are sufficient for all pages primarily in English, Spanish, French, German, and languages that require no more special characters than those (such as Catalan). These are also generally safe to use in titles, except for a few characters like double quotes, less than and greater than, and a few others.
Unsafe characters
editNote especially what is missing here from the full ISO-8859-1 set: The broken bar (0166=¦
[¦]¹), soft hyphen (0173=­
[]¹), superscript digits (0178=², 0179=³
[²]¹ and [³]¹), vulgar fractions (0188=¼, 0189=½, 0190=¾
[¼]¹ [½]¹ [¾]¹), Old English (and Icelandic and Old Norse language) eth and thorn (0208=Ð, 0240=ð, 0222=Þ, 0254=þ
[Ð]¹ [ð]¹ [Þ]¹ [þ]¹), and multiply sign (0215=×
[×]¹). These should be considered unsafe (and adequate substitutes are available for most of them).
Special care should be taken with characters that do exist in the native character set of popular machines but not in the above set. These are not safe, even though they may display correctly to you when you use them. Characters from Windows code page 1252 not in ISO-8859-1 include the euro sign (€
[€]¹), dagger and double dagger (†, ‡
[†]¹, [‡]¹), bullet (•
[•]¹), trade mark sign (™
[™]¹), typeset-style punctuation (see below), per mille sign (‰
[‰]¹), some Eastern European caron-accented letters, and the oe ligatures. Characters from the Macintosh Roman set not in ISO-8859-1 include dagger and double dagger, bullet, trade mark sign, a few math symbols such as infinity (∞
[∞]¹) and not equal (≠
[≠]¹), a few commonly-used Greek letters such as pi (π
[π]¹), ligatures like oe and fl, typeset-style punctuation, per mille sign, and lone accents such as the breve, ogonek, and caron.
HTML 4.0 defines named character entities for some Latin characters not in ISO-8859-1 that are used by popular languages, such as OE ligature (Œ, œ
[Œ]¹ [œ]¹), uppercase Y with diaeresis (Ÿ
[Ÿ]¹), and some Eastern European accented characters like š
[š]¹. These are also unsafe; though if they entered as HTML named character entity references, they may display on some machines.
In short, don't assume that it is safe to use a special character just because it looks correct on your machine. Use the ones from the table above, and read and understand how to use others shown below.
- ¹ sample in square brackets to see if they work on your configuration
Possibly usable non-ISO characters
editSome characters not listed as safe above may still be usable when entered as named HTML character entity references, because web browsers will recognize them and render them correctly, perhaps by switching to alternate fonts as needed. All of these should be considered less safe to use than those above, but only in the sense that they may not display properly, though in the form of HTML character entity references they are unambiguous, and preserve data integrity.
For many of these, adequate substitutes and workarounds are available, and should be used when the value of making the text available to users of older computers and software exceeds the value of good presentation to those with newer software (in the judgment of the author or editor).
Typeset-style Punctuation
editAbsent from the ISO-8859-1 character set, but commonly used and present in both Macintosh Roman and Windows code page 1252 character sets, are proper English quotation marks and dashes. These can be entered as character entity references, and should appear correctly on most machines running recent software. Even on ISO-based machines such as Unix/X, browsers should be able to interpret these references and make appropriate substitutes using plain ASCII straight quotes and hyphens. (Mozilla does this correctly, for example.) These references were not present in older versions of HTML, so may not be recognized by older software. Since using these characters maintains data integrity even on those machines that may not display them correctly, it should be considered safe to use these unless proper display on old software is critical. German "low-9" quotation marks are a similar case, but are less commonly translated by browsing software, and so are not quite as safe. The table below shows these characters next to a capital letter "O" for better visibility:
‘O | ‘ | left single quote | —O | — | em dash |
’O | ’ | right single quote | –O | – | en dash |
“O | “ | left double quote | ‚O | ‚ | single low-9 quote |
”O | ” | right double quote | „O | „ | double low-9 quote |
Many web sites targeted for a Windows-using audience use code page 1252 references for these characters: for example, using —
for the em dash. This is not a recommended practice. To ensure future data integrity and maximum compatibility, recode these as named references such as —
. If you really want to use a number, you can use ‒
.
Be aware that if you edit text in a separate word processor or other program to cut and paste into your browser, and it "automatically" converts quotes to the left and right "smart quotes" for you, you may unknowingly mangle markup, either your own or already existing, by replacing the standard quotes in HTML tags & properties with the smart quotes, which will cause the tags to fail in various ways. Furthermore, some people consider the extra encoding of smart quotes, fancy "’" apostrophes used in possessives and contractions, etc., to be a waste of bytes that could be put to better use, and will replace them with the standard single characters at will.
Set your wordprocessor options such as Auto Edit and Auto Correction such that undesired replacements do not occur.
Greek letters and math symbols
editCompare ∇ and <math>\nabla</math>, giving ∇ and , respectively. Depending on preferences, the second may be the same as the first (HTML rendering), or an image. The HTML symbol depends on the font size and type, the image has a fixed size in terms of pixels. The color of symbol and background in the first case are those of text in general, according to the settings, and for the image they are black on white.
- Note: much of the text below regarding mathematical symbols is obsolete now that MediaWiki supports embedded TeX within pages. Non-trivial mathematical equations are probably best notated in TeX using the MediaWiki math tags. See the page MediaWiki User's Guide: Editing mathematical formulae for more on this.
Web standards for writing about mathematics are very recent (In fact MathML 2.0 was just released in February of 2001.), so many browsers made before these standards were in place try to compensate by at least allowing characters commonly used in mathematics, including most of the Greek alphabet. These are necessarily entered as character entity references. Browsers often render these by switching to a "Symbol" font or something similar.
Upper- and lowercase Greek letters simply use their full names for character entities. These should, of course, only be used for occasional Greek letters in primarily-Latin text. (Large quantities of Greek-language text should be written using an editor with native UTF-8 Unicode support to facilitate editing and reduce page bloat). Here are a few samples:
α | α | Γ | Γ |
β | β | Λ | Λ |
γ | γ | Σ | Σ |
π | π | Π | Π |
σ | σ | Ω | Ω |
ς | ς (final sigma, lowercase only) |
Other common math symbols
≠ | ≠ | ′ | ′ |
≤ | ≤ | ″ | ″ |
≥ | ≥ | ∂ | ∂ |
≡ | ≡ | ∫ | ∫ |
≈ | ≈ | ∑ | ∑ |
∞ | ∞ | ∏ | ∏ |
√ | √ |
Many of the symbols in the Windows "Symbol" font commonly used for rendering mathematics (such as the expandable bracket parts) are not present on most other machines, and not even present in Unicode 3.1 or as HTML named entities (though they are planned for Unicode 3.2). These are used by products such as TtH to render equations. You should be aware that if you use these symbols, you are restricting your audience to Windows users (Whether or not that's acceptable is a judgement you will have to make as an author.). (Disputed section)
Other common symbols
editSome characters such as the bullet, Euro currency sign, and trade mark sign are special cases. They are likely to be understood and rendered in some way by many browsers. Because they are important for international trade, many computers specifically add them to fonts at some non-standard location and render them when requested, or else render them in special ways that don't require them to be present in a font. See below for how your browser renders these:
• | • | bullet |
€ | € | euro currency sign |
™ | ™ | trade mark sign |
Other somewhat less commonly used symbols include these:
† | † | dagger | ♠ | ♠ | black spade suit | |
‡ | ‡ | double dagger | ♣ | ♣ | black club suit | |
◊ | ◊ | lozenge | ♥ or ♥ | ♥ (see below) | red heart suit | |
← | ← | leftward arrow | ♦ or ♦ | ♦ (see below) | red diamond suit | |
↑ | ↑ | upward arrow | ‹ | ‹ | single left-pointing angle quote | |
→ | → | rightward arrow | › | › | single right-pointing angle quote | |
↓ | ↓ | downward arrow | ‰ | ‰ | per mille sign |
These should be considered unsafe to use except perhaps on pages intended for a specific audience likely to have very up-to-date software on popular machines. Even then, in some cases, IE 6.0 does not show the diamond symbol above. The regular diamond ♦ displays in IE 5 but not 6. The alternative code for the red diamond ♦, which works in IE 6 but not 5, is <font face="sans-serif" color="red">♦</font>.
Unicode
editThe official character set of HTML 4.01 is the ISO 10646 Universal Character Set, which is equivalent to the character set defined by Unicode. Many browsers, though, are only capable of displaying a small subset of the full UCS repertoire.
Numeric character entity references are the only way to enter these characters into a Wiki page at present.
There are two ways:
- decimal, e.g.
Й
giving Й on your browser - hexadecimal, in this case
Й
giving Й.
These should be the same. However, decimal encoding will increase the number of browsers on which they will work. [1] shows for all possible values whether they work and how they look in your browser, using decimal code.
For example, the codes Й ק م
display on your browser as Й, ק, and م, which ideally look like the Cyrillic letter "Short I", the Hebrew letter "Qof", and the Arabic letter "Meem", respectively. It is unlikely that your computer has all of those fonts and will display them all correctly unless you have a Macintosh or have installed the fonts, though it may display a subset of them. Because they are encoded according to the standard, though, they will display correctly on any system that is compliant and has the characters available.
These characters should not be used in MediaWiki pages unless they make no difference to the understanding of the text, and are just extra information.
See Unicode and HTML for character entities tables.
Advanced Entities
editThe following additional entities are available. On some browsers, these are converted to Unicode equivalents.
[table missing]
Special Note: The Del symbol ("nabla;"), among others, is not supported on Windows 95 or 98. On the English Wikipedia it has been uploaded as an image, and can there be referenced as [[File:Del.gif]], or here and some other projects as http://en.wikipedia.org/upload/d/db/Del.gif, and looks like this: http://en.wikipedia.org/upload/d/db/Del.gif. On projects where this does not work, upload a copy of the image to that project.
However, the del symbol is usually found in formulæ which are better facilitated using MediaWiki User's Guide: Editing mathematical formulae.
Hieroglyphs
editE.g. <hiero>P2</hiero> gives
|
This is not dependent on browser capabilities, because it uses images on the servers.
Browser differences
editNot all characters are displayed in all browsers. Also, since the font in the edit box may well be different from that of the rendered page, the browser may show the characters properly in one of the two areas and not in the other. For each, try to choose fonts which show all characters you need.
In the case of ISO-8859-1 encoding, special characters in the edit box are converted to code that consists of the common characters &, #, digits and a semi-colon, which are always displayed properly.
The HTML source code anyway shows the codes of both the characters that are displayed and those that are not. The HTML source code of a preview webpage also shows these for the wikitext.
Note that as a reader, it is best to use a browser with maximum capabilities, but as an author the least capable of the common browsers is a better guideline.
Alternatives include using a similar, more common symbol, or using an image, e.g. : http://eo.wikipedia.org/upload/d/db/Ikono_tero_malgranda.png.
Also you can describe the character.
See also
editExternal links
edit- http://www.unicode.org/charts/ Unicode character charts; hexadecimal numbers only; PDF files showing all characters independent of browser capabilities
- Table of Unicode characters from 1 to 65535 - shows how the decimal character references look in one's browser
- HTML 4.0 Character Entity References - shows how the named and decimal character references look in one's browser
- FileFormat.Info - details of many Unicode characters, including the named, decimal and hexadecimal character reference, showing how it should look and for each, how it looks in one's browser
- Alan Wood's Unicode Resources - comprehensive resource with character test pages for all Unicode ranges, as well as OS-specific Unicode support information and links to fonts and utilities.
Wikinews-specific content and links to other help pages
editHelp contents Reading:
Go |
Search |
URL |
Namespace |
Page name |
Section |
Link |
Backlinks |
Piped link |
Interwiki link |
Redirect |
Variable |
Category
|