:Help:Entering special characters

{{For|help viewing special characters|Help:Special characters}}

{{For|help with punctuation characters as used in Wikipedia|Help:Punctuation}}

{{Wikipedia how-to|H:ESC}}

Many special characters (those not on the standard computer keyboard) are useful—and sometimes necessary—in Wikipedia articles. Even articles that use only English words may use punctuation such as an em dash (—), and symbols such as a section sign (§) or registered mark (®). Articles about or that mention European persons or places may use many extended Latin characters, and articles about other persons and places may require characters from entirely different alphabets. This article describes several methods for entering such characters.

Entry methods

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

= Keyboard code =

Enter a Unicode character using an Alt code (Windows operating system), the Option key (Macintosh computer), or Unicode combination (Linux).

Some keyboards have a Compose key that provides similar functionality with some other operating systems.

Lists of Alt codes and Option key combinations are given in sources linked under External links.

On the iPhone and iPad (IOS), special characters are entered using the template {{Unicode|&#x any-four-digit-hex-number ;}}. (Space between { { should be removed.) This will display more accurately in some browsers, compared with the just &#x any-four-digit-hex-number ; . In this operating system, the menus of characters at the bottom of WP Edit pages are more limited than with Windows.

== Windows—Alt code ==

Under Windows, the {{key press|Alt}} key is pressed and held down while a decimal character code is entered on the numeric keypad; the {{key press|Alt}} key is then released and the character appears. The numerical code corresponds to the character’s code point in the Windows 1252 code page, with a leading zero; for example, an en dash (–) is entered using {{key press|Alt}}+0150. The leading zero is required; if it is omitted, a character corresponding to the code point in the default OEM code page is entered. For example, if the OEM default is code page 437, {{key press|Alt}}+150 gives û.

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 {{key press|Alt}}+decimal equivalent code numbers keys.

For example, the character é (Small e with acute accent, HTML entity code é) can be obtained by pressing {{key press|Alt|1}}{{key press|3}}{{key press|0}}. First press the {{key press|Alt}} key (and keep it depressed) with your left hand, then press the digit keys {{key press|1}}, {{key press|3}}, {{key press|0}}, in sequence, one by one, in the right-side numeric keypad part of the keyboard, then release the {{key press|Alt}} key.

Many special characters, however, for example λ (small lambda), cannot be obtained from their decimal code 955 (or 0955), by using it with the {{key press|Alt}} key inside Notepad or Internet Explorer). 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, which can then be copied and pasted where those characters are needed.

To correctly obtain special characters which have decimal code points above 255, another option (not available in Internet Explorer) is to use or type a character's hex equivalent code point first, followed by pressing the {{key press|Alt}}+X keys. To produce a λ, for example, open or start WordPad, Notepad, Word, LibreOffice Writer etc. editing application software, then type in 3BB (the hexadecimal equivalent numeric code point of the character λ), then press {{key press|Alt}}+X. Hex code 3BB will convert/turn into the λ character, which can now be copied and pasted where you want to use it. (In IE use its HTML hexadecimal equivalent code λ or its HTML decimal equivalent code λ.)

== Macintosh—Option key==

On a Macintosh computer, the {{key press|Opt}} key (and sometimes another key) is pressed and held down while another key is pressed; the {{key press|Opt}} key (and when applicable, the other key) is then released, and the character appears. For example, an en dash is entered using {{key press|Opt}}+-; an em dash (—) is entered using {{key press|Shift}}+{{key press|Opt}}+-.

Also on a Macintosh pressing and holding certain letters (the vowels and a few other letters) brings up a pop-up menu of related special characters, such as accented versions of vowels, which can be clicked on or selected numerically.

== Linux—Unicode ==

On Linux, one of three methods should work:

  • Hold {{keypress|Ctrl|Shift}} and type {{keypress|U}} followed by up to eight hex digits (on main keyboard or numpad). Then release {{keypress|Ctrl|Shift}}.
  • Hold {{keypress|Ctrl|Shift|U}} and type up to eight hex digits, then release {{keypress|Ctrl|Shift|U}}.
  • Type {{keypress|Ctrl|Shift|U}}, then release those and type up to eight hex digits, then type {{keypress|Enter}} or {{keypress|Space}}.

In LibreOffice, OpenOffice.org and Inkscape, for example, only the second method works. In GTK only the third method works.

== iOS ==

In the iOS operating system, used on the iPhone and iPad, accented characters used in Western European languages are generated by holding the finger down on the character needing a diacritic, which opens a menu. Some of the most common special characters are also generated this way. Holding the finger on the $ key, for example, accesses ₽ (Spanish peseta, pre-Euro Spanish money), ¥ (yen), € (euro), ¢, £, and ₩. The en dash, em dash, and • are accessed by holding the hyphen key down. The § is accessed by holding the & down. In addition, there are 308 alternate keyboards which are installed via Settings - General - Language and region - Add language. These include Arabic, Russian, Hebrew, Punjabi, and many obscure ones, like Yiddish, Thai, and Armenian.

It is not possible to directly install a new operating system font in iOS. Third-party applications offer fonts, mostly sans-serif decorative fonts not suitable for text, in the form of alternative keyboards. These programs resemble a TSR Terminate and Stay Resident program under MS-DOS: one runs the program to install the font/keyboard, then exits the program. Keyboards installed are selected by the globe to the left of the spacebar. These programs, since third parties can under some conditions access the users' typing, can bring security risks. Other third-party occupations offer fonts that are only usable within the application.

= External application =

==Windows==

Select, copy and paste the character from the Character Map application.

==Macintosh==

There are two external options:

  • Enter the character by double-clicking on the character you want in the Special Characters tool, available at the bottom of any Edit menu. You can customize the character sets that are shown, e.g., to add more phonetic alphabet symbols, by following the directions [http://support.apple.com/kb/PH10758 given here].
  • Enable the Input menu (via the 'Input Sources' panel of the 'Keyboard' System Preferences). This gives access to:
  • the Keyboard Viewer, which can be used to view and input characters accessed via the {{Key press|Option}} key
  • the Character Viewer, which can be used to access any Unicode character. It is also available from the Special Characters tool

==Linux==

Select, copy, and paste the character using the [https://wiki.gnome.org/Apps/Gucharmap GNOME Character Map]. If not already installed along with GNOME, it is usually available as "gucharmap" (which can be installed with "yum install gucharmap" as root on a Redhat-like Linux distribution, for example).

In KDE, a similar application is named "KCharSelect". In Debian Linux specifically, you can type "sudo apt install kcharselect" to install it.

==Problems with HTML references==

Because a character reference uses only ASCII characters, it does not require that a Web browser support Unicode, and it is unambiguous when a Web page does not announce its character encoding, when the browser’s encoding is incorrectly manually set, and even when the character does not display properly with some browsers. Accordingly, it is usually the most "Web safe" approach. However, character references are distracting for many editors, and they may cause difficulties with searches in Wikipedia (see below).

Some old browsers incorrectly interpret codes in the range 128–159 as references to the native character set. Because the code points 128 through 159 are not used for displayable glyphs in either ISO-8859-1 or 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 the language in Turkey, see: Help:Turkish characters. (More may be added to this list as contributors in other languages appear, although according to this deletion and this discussion, there may be little need for such lists in the future.)

Editing notes for specific writing systems

=Egyptian Hieroglyphs=

E.g., P2 gives P2 See Help:WikiHiero syntax.

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

Hieroglyphs can also be represented in Unicode using the [http://users.teilar.gr/~g1951d/ Aegyptus] font.

=Esperanto=

class="wikitable" style="float: right; margin-left: .5em;"

! in edit box !! in database and output

SS
SxŜ
SxxSx
SxxxŜx
SxxxxSxx
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 (Cc, Gg, Hh, Jj, Ss, Uu), 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

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!).

=Google Chrome=

Google Chrome and Chromium both have a cross-platform bug that prevents the use of font substitution.{{cite web

| url =http://code.google.com/p/chromium/issues/detail?id=108591

| title =Font substitution fails on runic unicode characters

| author =

| date =Dec 24, 2011

| work =

| publisher =Chromium project

| accessdate =November 29, 2012

}} This means that even if the user has the correct typeface for a given script installed, it may not display correctly or at all.

=Console browsers=

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 not they are unsafe. 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=

class="wikitable" style="float: right; margin-left: .5em;"

! 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.

Please take into consideration

=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 + − < > ⊂ ⊃ 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.

= Special characters and searches =

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.

See also

References

  • [http://www.w3.org/TR/1999/REC-html401-19991224/ HTML 4.01 Specification]. Cambridge, MA: W3C, 1999.
  • [https://www.unicode.org/versions/Unicode6.0.0/ Unicode 6.0.0], the Unicode standard. Mountain View, CA: Unicode, Inc., 2010.