Open main menu

lensowiki β

Changes

Help:Special characters

19,600 bytes added, 20:10, 18 July 2006
{{H:h|editor toc}}

<div class="boilerplate metadata" style="background-color: #f3f9ff; margin: 1em 2.5% 0 2.5%; padding: 0 10px; border: 1px solid #aaa;">
'''Technical note''': <small>Due to technical limitations, some [[w:web browser|web browser]]s may not display some '''special characters''' in this article. Such characters may be rendered as boxes, question marks, or other replacement symbols, depending on your browser, operating system, and installed fonts. Even if you have ensured that your browser is interpreting the article as [[w:UTF-8|UTF-8]] encoded and you have installed [[w:List of typefaces#Unicode_fonts|Unicode font]](s) that supports a wide range of [[Unicode]] [[w:Mapping of Unicode characters|blocks]], fonts such as ''[[w:Arial Unicode MS|Arial Unicode MS]]'', ''[[w:Code2000|Code2000]]'', ''[[w:Code2001|Code2001]]'', ''[[w:TITUS (project)|TITUS Cyberbit Basic]]'', ''[[w:Lucida Sans Unicode|Lucida Sans Unicode]]'' or one of the [[w:Free software Unicode fonts|Free software Unicode fonts]], you may still need to use a different browser, as browser capabilities in this regard tend to vary.</small>
<includeonly>[[Category:Pages with special characters|{{PAGENAME}}]]</includeonly>
</div>

==Systems for character encoding==
From MediaWiki 1.5, all projects use '''[[w:Unicode|Unicode]] ([[w:UTF-8|UTF-8]])''' [[w:character encoding|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 [[w:ISO 8859-1#Windows-1252|windows-1252]] (they declared themselves to be [[w:ISO-8859-1|ISO-8859-1]] but in reality browsers treat the two as synonymous and the mediawiki software made no attempt to prevent use of stuff from 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 [[Data dumps#What_happened_to_the_SQL_dumps.3F|xml dumps rather than database dumps]].

*'''Unicode (UTF-8)'''
**a variable number of bytes per character
**special characters, including [[w:CJK|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 &euro; the '''named character reference''' &amp;euro; and the '''decimal character reference''' &amp;#8364; and the '''hexadecimal character reference''' &amp;#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 [[Help:Automatic conversion of wikitext|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 &amp;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 such as 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" />

==Editing==

Many characters not in the repertoire of standard [[w:ASCII|ASCII]] will be useful&mdash;even necessary&mdash;for [[w:Wiki|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 four ways to enter a non-ASCII character into the wikitext:

* Use a link to a special character listed under the edit box to insert that character. Note however that some characters are not displayed in Internet Explorer:<br>[[Image:Special characters under edit box, IE.png|500px]]<br>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.
* 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. 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 [[Help:HTML in wikitext|HTML]] named character entity reference like <code>&amp;agrave;</code>. 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 reference like <code>&amp;#161;</code>. Unfortunately some old browsers incorrectly interpret these as references to the native character set.<!--which ones?--> It is, however, the only way to enter [[w:Unicode|Unicode]] values for which there is no named entity, such as the [[Help:Turkish characters|Turkish]] letters. Because the code points 128 to 159 are unused in both [[w:ISO-8859-1|ISO-8859-1]] and [[w:Unicode|Unicode]], character references in that range such as <code>&amp;#131;</code> are illegal and ambiguous, though they are commonly used by many web sites. (They are not technically unused, but they map to rare control codes that are illegal in HTML.) 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 en, 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.)

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&mdash;the entities should be folded into their raw character equivalents so all searches on them are equivalent. See also [[Help:Searching]].

===Esperanto===
<table border=1 align=right>
<tr><td>in edit box<td>in database and output</tr>
<tr><td>S<td>S</tr>
<tr><td>Sx<td>Ŝ</tr>
<tr><td>Sxx<td>Sx</tr>
<tr><td>Sxxx<td>Ŝx</tr>
<tr><td>Sxxxx<td>Sxx</tr>
<tr><td>Sxxxxx<td>Ŝxx</tr>
</table>

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 x's follow these characters or their non-accented forms (A, G, H, J, S, U, c, g, h, j, s, u), the number of x's in the edit box is double the number in the actual stored article text.

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

===Browser issues===
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 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!).

====IE for the Mac====
This relatively common browser translates to [[w:mac-roman|mac-roman]] for the edit box with the result it munges most Unicode stuff (usually but not always by replacing them with a question mark). It also munges things that are in ISO-8859-1 but not mac-roman (specifically ¤ ¦ ¹ ² ³ ¼ ½ ¾ Ð × Ý Þ ð ý þ and the soft hyphen) so the problems it causes are not limited to Unicode wikis (though they tend to be much worse on Unicode wikis because they affect actual text and interwiki links rather than just fairly obscure symbols).

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

====Console browsers====
Lynx, links (in text mode) and W3M convert to the console character set (lynx 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====
<table align="right" border="1" cellspacing="0" cellpadding="4">
<tr>
<td>In database and edit<br>box for normal browsers</td>
<td>In edit box<br>for bad browsers</td>
<tr>
<td>œ<td>&amp;#x153;</td>
<tr>
<td>&amp;#x153;<td>&amp;#x0153;</td>
<tr>
<td>&amp;#x0153;<td>&amp;#x00153;</td>
<tr>
<tr>
<td>PG&G Company;</td>
<tr>

</table>
After en 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 broken browsers to edit safely provided mediawiki knew they were broken.

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 repreresented 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 problem. Hopefully the default list will be expanded in future but that relies on getting someone with cvs access to commit the changes.

==Viewing==
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 en there are a set of templates to do this. For example {{tlw|unicode}} for general Unicode text, {{tlw|polytonic}} for [[w:polytonic Greek|polytonic Greek]] and {{tlw|IPA}} for the [[w:International Phonetic Alphabet|International Phonetic Alphabet]]. The stuff in [[w:Windows Glyph List 4|Windows Glyph List 4]] should be safe to use without such special measures.

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

==Displaying Special Characters==

To display Unicode or special characters on web page(s), one or more of the [[w:List of typefaces#Unicode_fonts|Unicode fonts]] need to be present or installed in your computer, first. For proper working functionality, ''setup'' or ''configuration'' or ''settings'' of the web page viewing browser software is also need to be modified.

The default font for Latin scripts in [[w:Internet Explorer|Internet Explorer]](IE) web browser for Windows is [[w:Times New Roman|Times New Roman]]. It doesn't include many [[w:Mapping of Unicode characters|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 [[w:Lucida Sans Unicode|Lucida Sans Unicode]] font, which comes with Windows XP, [[w:DejaVu Sans|DejaVu Sans]], [[w:TITUS Cyberbit Basic|TITUS Cyberbit]], [[w:GNU Unifont|GNU Unifont]] which are freely available, or [[w:Arial Unicode MS|Arial Unicode MS]], which comes with Microsoft Office. Alternatively, the style sheet page related to the web page(s), could also try using Unicode-range specifications to note the gaps where ''Times New Roman'' does not have glyphs from Unicode blocks, such as, Hawaiian [[w:Okina|‘okina]] (glottal stop), etc. and thus force the browser to check further down the list of next fonts to try to display those special characters. Special symbols should display properly without further configuration with [[w:Mozilla Firefox|Mozilla Firefox]], [[w:Konqueror|Konqueror]], [[w:Opera|Opera]], [[w:Safari|Safari]] and most other recent browsers.

To use one of the available Unicode fonts for displaying special characters inside a [[w:HTML Table|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 [[Help:Table|wiki table]] code, use that after the (TR equivalent) "'''&#124;-'''" (like, '''&#124;- class="Unicode"''').

For displaying individual special character, template code '''&#123;&#123;Unicode|'''''char'''''&#125;&#125;''' for each character can be used. HTML decimal or [[w:hexadecimal|hexadecimal]] numeric entity codes can be used in the place of the ''char''. If a paragraph with lots of special Unicode characters need to be displayed, then, '''&#60;p class="Unicode">''' ... '''&#60;/p>''', or, '''&#60;span class="Unicode">''' ... '''&#60;/span>''' code 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 [[w:Unicode Latin|latin scripts]], then '''class="latinx"''' can be used. For special characters or symbols related to [[w:International Phonetic Alphabet|International Phonetic Alphabet]], '''class="IPA"''' can be used. For [[w:Polytonic orthography|polytonic (Greek)]] characters or related symbols, '''class="polytonic"''' can be used.

==Egyptian Hieroglyphs==

E.g. <nowiki><hiero>P2</hiero></nowiki> gives <hiero>P2</hiero> 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 for this is likely to be near non-existent.

==Linking text with special characters==
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 + &minus; < > &sub; &sup; gives [[x|+]] [[&minus;]] [[x|<]] [[x|>]] [[&sub;]] [[&sup;]] which may look like ± = &le; &ge; &sube; &supe;. In such cases one can better use a separate link:
* A &sub; B (see [[w:Subset|subset]])

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

== Alt Keycodes ==
&#160;&#160;''See also : [[w:Windows Alt keycodes|Windows Alt keycodes]]''

Many special characters which have decimal equivalent codepoint numbers that are 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 "&amp;eacute;") can be obtained by pressing Alt + 130.

Which means, first press the "Alt" key and keep on pressing it (or keep on holding it), 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, &#955; (small lambda) cannot be obtained from its decimal code 955 or 0955, by using it with the Alt key. If used, you'll get wrong character "╗" or "»".

To obtain such special characters correctly, which have decimal codepoint values above the 256, you will have to type its hex equivalent codepoint 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 '''3BB''', which is a hexadecimal equivalent numeric codepoint of the character '''&#955;''', then press Alt+X. Hexcode ''3BB'' will convert/turn into the ''&#955;'' character. If you press the Alt+X key combination again, then &#955; character will convert back to its hex equivalent codepoint, ''3BB''. Now you can copy paste the character where you want to use, or, use its html hexadecimal equivalent code &amp;#x3BB; or its html decimal equivalent code &amp;#955;.

==See also==
*[[w:Mapping of Unicode characters]]
*[[Help:Formula]]
*[[Help:URL]]
*[[Help:Romanian characters]]
*[[Help:Turkish characters]]
*[[w:Talk:Runic alphabet]]
*[[w:en:Alphabets derived from the Latin]]
*[[w:Unicode#Input_methods|Unicode input methods]]
*[[w:Windows Alt keycodes|Windows Alt keycodes]] chart and Alt+X keycodes chart.
*[[Help:Advanced editing#Special characters]]

==External links==

*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
* [http://unicode.coeurlumiere.com/ Table of Unicode characters from 1 to 65535] - shows how the decimal character references look in one's browser
*[http://www.alanwood.net/demos/ent4_frame.html HTML 4.0 Character Entity References] - shows how the named and decimal character references look in one's browser
*[http://www.fileformat.info/info/unicode/block/index.htm 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
*[http://www.alanwood.net/unicode/index.html 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.
*[http://www.tacowidgets.com/widgets/characterpal/ CharacterPal] - Free Mac OS X Dashboard Widget that displays key combinations for special characters.
{{H:f|langs=|enname=Special characters}}
Anonymous user