Help:Special characters

From Wikipedia
Jump to: navigation, search

Many characters not on the standard computer keyboard will be useful—even necessary—for projects in a non-Latin-alphabet language. This page contains recommendations for which characters are safe to use and how to enter them.

Editing[edit]

Entering special characters[edit]

There are several ways to enter a special character into wikitext:

  • Use a special-character link to enter a Unicode (UTF-8) character. Links are available under Special characters above the edit window, and below the buttons at the bottom of the edit window. Clicking a special-character link inserts that character at the current position of the cursor in the edit window, so you need to position the cursor where you want it before clicking the link.

    Some characters are not displayed in Internet Explorer 6: Special characters under edit box, IE. In some fonts, e.g., Arial, all the characters in this box are displayed, but it is not convenient for a user to have to switch fonts between webpages. You have to install the CharInsert extension to use this.

  • Enter a Unicode character using an Alt code (Windows operating system) or the Option key (Macintosh computer).
  • Enter a Unicode character directly from a foreign keyboard, or by copying and pasting from an application such as Character Map (Windows operating system), or by some special means provided by the operating system or a text-editing application. On ISO-8859-1 wikis some browsers will change characters outside the charset of the wiki into HTML numeric character entities (see below).
  • Use an HTML named character entity reference like à. Because it uses only ASCII characters, this approach is unambiguous even when the server does not declare its character encoding, 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 reference like ¡. Some old browsers incorrectly interpret codes in the range 128–159 as references to the native character set; however, a numerical character reference is the only way in HTML to enter special characters for which there are no named entities, such as the Turkish letters. Because the code points 128 through 159 are not used for displayable glyphs in either ISO-8859-1 and Unicode, character references in that range (such as ƒ) are illegal in HTML and ambiguous, though they are commonly used by many web sites. Almost all browsers treat ISO-8859-1 as Windows-1252, which does have printable characters in that space, and they often found their way into article titles on English projects, which really caused confusion when trying to create interwiki links to said pages.

Generally speaking, Western European languages, such as Spanish, French, and German pose few problems. For specific details about other languages, see: Help:Turkish characters and Help:Romanian characters. (More will be added to this list as contributors in other languages appear.)

Wikipedia searches are easier if a special character is entered as Unicode. If an HTML entity is used, a word like Odiliënberg can only be found by searching for Odili, euml, nberg or combination thereof; 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.

Esperanto[edit]

in edit box in database and output
S S
Sx Ŝ
Sxx Sx
Sxxx Ŝx
Sxxxx Sxx
Sxxxxx Ŝxx

MediaWiki installations configured for Esperanto use UTF-8 for storage and display. However, when editing the text is converted to a form that is designed to be easier to edit with a standard keyboard.

The characters for which this applies are: Ĉ, Ĝ, Ĥ, Ĵ, Ŝ, Ŭ, ĉ, ĝ, ĥ, ĵ, ŝ, ŭ. You may enter these directly in the edit box if you have the facilities to do so. However when you edit the page again you will see them encoded as Sx. This form is referred to as "x-sistemo" or "x-kodo". In order to preserve round-trip capability when one or more xs follow these characters or their non-accented forms (C, G, H, J, S, U, c, g, h, j, s, u), the number of xs in the edit box is double the number in the actual stored article text.

For example, the interlanguage link [[en:Luxury car]] to en:Luxury car has to be entered in the edit box as [[en:Luxxury car]] on eo:. This has caused problems with interwiki update bots in the past.

Browser issues[edit]

Some browsers are known to do nasty things to text in the edit box. Most commonly they convert it to an encoding native to the platform (whilst the NT line of Windows is internally UCS-2LE—2 Byte subset of UTF-16—it has a complete duplicate set of APIs in the Windows ANSI code page and many older apps tend to use these, especially for things like edit boxes). Then they let the user edit it using a standard edit control and convert it back. The result is that any characters that do not exist in the encoding used for editing get replaced with something that does (often a question mark though at least one browser has been reported to actually transliterate text!).

Internet Explorer for Mac[edit]

As of 2011, Internet Explorer for the Mac would be over five years old, so using the free Firefox web browser or the Safari web browser instead is highly recommended as it should be included on every Mac OS X install since version 10.3 ("Panther"; released 24 October 2003).

This browser translates to mac-roman for the edit box and fails to display most Unicode (usually but not always replacing it with question marks). It also replaces things that are in ISO-8859-1 but not mac-roman (specifically ¤ ¦ ¹ ² ³ ¼ ½ ¾ Ð × Ý Þ ð ý þ and the soft hyphen) so the problems are not limited to Unicode wikis (though they tend to be much worse because they affect actual text and interwiki links rather than just fairly obscure symbols).

Netscape 4.x[edit]

Similar issues to IE Mac though the character set converted to and from will obviously not always be mac-roman.

Console browsers[edit]

Lynx, Links (in text mode) and W3M convert to the console character set (Lynx and Links actually using a transliteration engine) for editing and convert back on save. If the console character set is UTF-8 then these browsers are Unicode safe but if it isn't they aren't. With Lynx and Links a possible detection method would be to add another edit box to the login form but this won't work for W3M as it doesn't convert the text to the console character set until the user actually attempts to edit it.

The workaround[edit]

In database and edit
box for normal browsers
In editbox for
trouble browsers
œ œ
œ œ
œ œ

After English Wikipedia switched to UTF-8 and interwiki bots started replacing HTML entities in interwikis with literal Unicode text, edits that broke Unicode characters became so common they could no longer be ignored. A workaround was developed to allow the problematic browsers to edit safely provided that MediaWiki knew they have problems.

Browsers listed in the setting $wgBrowserBlackList (a list of regexps that match against user agent strings) are supplied text for editing in a special form. Existing hexadecimal HTML entities in the page have an extra leading zero added, non-ASCII characters that are stored in the wikitext are represented as hexadecimal HTML entities with no leading zeros.

Currently the default settings only have IE Mac and a specific version of Netscape 4.x for Linux in the blacklist. Nevertheless it seems to have stopped most of the problems. Hopefully the default list will be expanded in future but that relies on getting someone with CVS access to commit the changes.

Viewing[edit]

Most current browsers have some level of Unicode support but some do it better than others. The most commonly encountered problem is that Internet Explorer relies on preconfigured font links in the registry rather than actually searching for a font that can display the character in question. This means that Internet Explorer often has to be forced to use particular fonts. On English Wikipedia there are a set of templates to do this. For example {{unicode}} for general Unicode text, {{polytonic}} for polytonic Greek and {{IPA}} for the International Phonetic Alphabet. The stuff in Windows Glyph List 4 should be safe to use without such special measures.

<font face="Arial Unicode MS">...</font> may work, but only for people with that font.

Displaying special characters[edit]

To display Unicode or special characters on web page(s), one or more of the Unicode fonts need to be present or installed in your computer, first. For proper working functionality, setup or configuration or settings from the web page viewing browser software also needs to be modified.

The default font for Latin scripts in Internet Explorer (IE) web browser for Windows is Times New Roman. It doesn't include many Unicode blocks. To properly view special characters in IE, you must set your browser font settings to a font that includes many Unicode blocks of characters, such as TITUS Cyberbit and GNU Unifont, which are freely available.

Special symbols should display properly without further configuration with Konqueror, Opera, Safari and most other recent browsers. An optional step can be taken for better (and correct) display of characters with ligature forms, combined characters, after the previously mentioned steps were followed, is to install a rendering engine software.

With Mozilla Firefox, the default setting must be changed. To do that, click on 'Options' in the 'Tools' menu and select the 'Content' icon. On that menu click 'Advanced' under 'Fonts and Colors'. Uncheck the default box "allow pages to choose their own fonts", and choose one of the Unicode options (for example, "Unicode (UTF-32BE)") or "Arabic (ISO-8859-6)" in the 'Default character encoding' box. An alternative is to switch font to 'Arial Unicode MS'. Then the default box can be left checked.

To use one of the available Unicode fonts for displaying special characters inside a table or chart or box, specify the class="Unicode" in the table's TR row tag (or, in each TD tag, but using it in each TR is easier than using it in each TD), in wiki table code, use that after the (TR equivalent) |- (e.g., |- class="Unicode").

For displaying individual special characters, template code {{Unicode|char}} can be used for each character. HTML decimal or hexadecimal numeric entity codes can be used in the place of the char. If a paragraph with lots of special Unicode characters needs to be displayed, then, <p class="Unicode"> ... </p>, or, <span class="Unicode"> ... </span> can also be used.

The class="Unicode" is to be used in web page(s), HTML or wiki tags, where various characters from wide range of various Unicode blocks need to be displayed. If the special characters that need to be displayed on web page(s) are mostly covering fewer Unicode blocks, related to latin scripts, then class="latinx" can be used. For special characters or symbols related to International Phonetic Alphabet, class="IPA" can be used. For polytonic (Greek) characters or related symbols, class="polytonic" can be used.

Changing Internet Explorer's (IE) default font[edit]

From the IE menu bar, follow this path:  Tools > Internet Options > Fonts > Webpage Font:
to a scrolling list of fonts. As indicated above, the default selection for Windows is Times New Roman. For viewing of many special characters, select a different font, such as Lucida Sans Unicode, and then select OK.

Unicode and ISO 8859-1[edit]

From MediaWiki 1.5, all projects use Unicode (UTF-8) character encoding.

Until the end of June 2005, when this new version came into use on Wikimedia projects, the English, Dutch, Danish, and Swedish Wikipedias used Windows-1252 (they declared themselves to be ISO-8859-1 but in reality browsers treat the two as synonymous and the MediaWiki software made no attempt to prevent use of characters exclusive to windows-1252). Pre-upgrade wikitext in their databases remains stored in Windows-1252 and is converted on load (some of it may also have been converted by gradual changes in the way history is stored). Edits made since the upgrade will be stored as UTF-8 in the database. This conversion on load process is invisible to users. It is also invisible to reusers as Wikimedia now uses XML dumps rather than database dumps.

Unicode (UTF-8)
  • 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.
ISO 8859-1
  • 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 &euro; and the decimal character reference &#8364; and the hexadecimal character reference &#x20AC;. The edit box shows the entered code, the webpage the resulting character. Unavailable characters which are copied into the edit box are first displayed as the 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 &eacute;, although allowed, is not needed.

Note that Special:Export exports using UTF-8 even if the database is encoded in ISO 8859-1, at least that was the case for the English Wikipedia, already when it used version 1.4.

To find out which character set applies in a project, use the browser's "View Source" feature and look for something like this:

<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />

or

<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

Egyptian Hieroglyphs[edit]

E.g., <hiero>P2</hiero> gives

P2

See Help:WikiHiero syntax.

This is not dependent on browser capabilities, because it uses images on the servers.

Hieroglyphs could also be represented using Unicode. However, browser support is likely to be near non-existent.

Ancient scripts[edit]

e.g. Phoenician alphabet, Old Italic alphabet, Linear B, etc.

Windows users

Please download and install one of these freely licensed fonts

Linux users

If using a Debian-based Linux (e.g. Ubuntu, Linux Mint), please download and install deb package ttf-ancient-fonts via Synaptic.

Shavian text[edit]

  • Copyleft font is available from here.

Glagolitic text[edit]

Linking text with special characters[edit]

Many users have settings giving underlined links. When linking a special character, in some cases the result may be mistaken for another character with a different meaning:

Linking + − < > ⊂ ⊃ gives + < > which may look like ± = ≤ ≥ ⊆ ⊇. In such cases one can better use a separate link:

There is less risk of confusion if more than one character is linked, e.g. x > 3.

Alt keycodes for Windows computers[edit]

On a computer running the Microsoft Windows operating system, many special characters that have decimal equivalent codepoint numbers below 256 can be typed in by using the keyboard's Alt+decimal equivalent code numbers keys.

For example, the character é (Small e with acute accent, HTML entity code &eacute;) can be obtained by pressing Alt+130.

Which means, first press the Alt key (and keep it depressed) with your left hand, then press the digit keys 1, 3, 0, in sequence, one by one, in the right-side numeric keypad part of the keyboard, then release the Alt key.

But special characters, for example, λ (small lambda), cannot be obtained from its decimal code 955 or 0955, by using it with the Alt key, if used inside Notepad or Internet Explorer (IE). You'll get a wrong character, "╗" or "»".

The Wordpad editor accepts (decimal numeric entity codepoints) values above 255, so it can be used to obtain the special/Unicode characters, then copy and paste where those characters are needed.

To correctly obtain such special characters, which have decimal code points above 255, another option is to use or type a character's hex equivalent code point first, then press Alt+X keys. To do this, open or start Wordpad, Word, etc. editing application software, (this Alt+X process will not work in Internet Explorer, Notepad, etc). Type in <ode>3BB, which is a hexadecimal equivalent numeric code point of the character λ, then press Alt+X. Hex code 3BB will convert/turn into the λ character. If you press the Alt+X key combination again, then λ character will convert back to its hex equivalent code point, 3BB. Now character(s) can be copied and pasted where you want to use them, or, (in IE) use its HTML hexadecimal equivalent code &#x3BB; or its HTML decimal equivalent code &#955;.

See also[edit]

External links[edit]

  • http://www.unicode.org/charts/ Unicode character charts; hexadecimal numbers only; PDF files showing all characters independent of browser capabilities
  • http://www.unicode.org/help/display_problems.html Help for enabling Unicode support on most platforms
  • 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
  • CharacterPal—Free Mac OS X Dashboard Widget that displays key combinations for special characters
  • A converter that helps one find the right escape sequence to use—helps when one needs to escape ASCII/Unicode characters that are special characters in wiki markup

als:Hilfe:Sonderzeichen ang:Wikipedia:Sundortácnu fr:Aide:Caractères spéciaux lb:Wikipedia:Sonnerzeechen sv:Wikipedia:Specialtecken