Template:Unicode/doc: Difference between revisions

Content deleted Content added
No edit summary
add doc for revised template
 
(37 intermediate revisions by 22 users not shown)
Line 1:
{{documentationDocumentation subpage}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
 
'''Template:Unicode''' was created to improve the presentation of Unicode characters on some very old browsers (especially IE6). It took one parameter, which was a string which could contain Unicode characters beyond the ASCII subset. It simply passed through its parameter for most browsers, but for older browsers could add HTML code to improve that browser's presentation of the characters.
{{TOCright}}
 
After IE6 was deemed too old to support, this template [[Template talk:Unicode|was deprecated]], and its implementation was made into a pure identity function, just passing through its parameter. Usages of the template were removed from all articles; the template had been used on at least 60,000 to 100,000 articles.
== Usage ==
 
Sometime after that, this template was changed again, to start showing a list of other templates that might be of interest (in the form of a so-called "template disambiguation"). This had the unfortunate effect of breaking the displayability of millions of old revisions of tens of thousands of articles. (The template change replaced a string or single unicode character in the displayed revision with a large mass of unrelated text, plus error messages, at each place the template was used in the old article revision.)
In its basic version, this template sets the font for its argument to one which is likely to support special symbols. The argument is specified using [[Html_characters#HTML_character_references|HTML character encoding]], either in decimal (e.g. <tt>&amp;#123;</tt>) or hexadecimal (e.g. <tt>&amp;#xA9;</tt>). Examples:
 
To correct that problem, the template was made into the current form, which again passes through its parameter when invoked but also when the template page itself is viewed shows the list of other templates of interest.
* {{code|<nowiki>{{unicode|&amp;#x22CA;}}</nowiki>}} → {{unicode|&#x22CA;}}
* {{code|<nowiki>{{unicode|&amp;#8906;}}</nowiki>}} → {{unicode|&#8906;}}
* {{code|<nowiki>{{unicode|&#8906;}}</nowiki>}} → {{unicode|&#8906;}} (this may look trivial, but could be helpful in some browsers)
or
* {{code|<nowiki>{{unicode|&amp;#x22C9;}}</nowiki>}} → {{unicode|&#x22C9;}}
* {{code|<nowiki>{{unicode|&amp;#8905;}}</nowiki>}} → {{unicode|&#8905;}}
* {{code|<nowiki>{{unicode|&#8905;}}</nowiki>}} → {{unicode|&#8905;}}
 
==Subject==
The template also takes a ''subject'' parameter, to use alternate fonts for specific sets of characters, organized thematically, where the usual fonts don't provide glyphs. The currently supported subjects are animal, astro, chem, communication, dentistry, education, emoticon, enclosed, event, food, game, map, medicine, money, music, person, picto, plant, politicsreligion, region, sport, technology, time, ui, warning, weather. <!-- EDITORS, the COMPLETE list of which symbols are included in which subjects, and support for the subjects by various fonts, is in the TALK page for the doco. The displayed doco may be outdated, or have only an abbreviated list for illustrative purposes. --> Depending on your browser's built-in font substitution capabilities, and fonts you have installed, you may or may not see any difference.
 
{| class="wikitable"
! width="28%" | plain
! width="28%" | <code><nowiki>{{unicode|}}</nowiki></code>
! {{para|subject|}}
! width="28%" | <code><nowiki>{{unicode||subject=}}</nowiki></code>
! note
|-
{{unicode/example|🐀🐁🐂🐃🐄🐅🐆🐇🐈🐉🐊🐋🐌🐍🐎🐏 🐐🐑🐒🐓🐔🐕🐖🐗🐘🐙🐚🐛🐜🐝🐞🐟 🐠🐡🐢🐣🐤🐥🐦🐧🐨🐩🐪🐫🐬🐭🐮🐯 🐰🐱🐲🐳🐴🐵🐶🐷🐸🐹🐺🐻🐼🐽🐾 😸😹😺😻😼😽😾😿🙀 🙈🙉🙊|subject=animal}}
{{unicode/example|☀ ☄★☆ ☉☊☋☌☍ ☼☽☾☿ ♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏ ♐♑♒♓ ⚳⚴⚵⚶⚷⚸⚹⚺⚻⚼ ⛎ ⛢ ⭐⭑⭒ 🌃 🌌🌍🌎🌏 🌐🌑🌒🌓🌔🌕🌖🌗🌘🌙🌚🌛🌜🌝🌞🌟🌠 🔭|subject=astro}}
{{unicode/example|⌬ ⏣ ⚗ 🜀🜁🜂🜃🜄🜅🜆🜇🜈🜉🜊🜋🜌🜍🜎🜏 🜐🜑🜒🜓🜔🜕🜖🜗🜘🜙🜚🜛🜜🜝🜞🜟 🜠🜡🜢🜣🜤🜥🜦🜧🜨🜩🜪🜫🜬🜭🜮🜯 🜰🜱🜲🜳🜴🜵🜶🜷🜸🜹🜺🜻🜼🜽🜾🜿 🝀🝁🝂🝃🝄🝅🝆🝇🝈🝉🝊🝋🝌🝍🝎🝏 🝐🝑🝒🝓🝔🝕🝖🝗🝘🝙🝚🝛🝜🝝🝞🝟 🝠🝡🝢🝣🝤🝥🝦🝧🝨🝩🝪🝫🝬🝭🝮🝯 🝰🝱🝲🝳|subject=chem}}
{{unicode/example|☎☏ ✆ ✉ ✍✎✏✐✑✒ 💌 💬💭 📕📖📗📘📙 📝📞📟 📠📡📢📣📤📥📦📧📨📩📪📫📬📭📮📯 📰📱📲📳📴📵📶 📺📻|subject=communication}}
{{unicode/example|⎾⎿⏀⏁⏂⏃⏄⏅⏆⏇⏈⏉⏊⏋⏌|subject=dentistry}}
{{unicode/example|✎✏✐ 🍎🍏 🎒🎓 🏫 💯 📏 📓📔📕📖📗📘📙📚|subject=education}}
{{unicode/example|☹☺☻ ♡ ♥ ❤ 💋 💏💐💑💒💓💔💕💖💗💘💙💚💛💜💝💞💟 😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏 😐😑😒😓😔😕😖😗😘😙😚😛😜😝😞😟 😠😡😢😣😤😥😦😧😨😩😪😫😬😭😮😯 😰😱😲😳😴😵😶😷😸😹😺😻😼😽😾😿🙀 🙅🙆🙇🙈🙉🙊🙋🙌🙍🙎🙏|subject=emoticon}}
{{unicode/example|①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯ ⑰⑱⑲⑳⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿ ⒀⒁⒂⒃⒄⒅⒆⒇⒈⒉⒊⒋⒌⒍⒎⒏ ⒐⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛⒜⒝⒞⒟ ⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯ ⒰⒱⒲⒳⒴⒵ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿ ⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟ ⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ⓪⓫⓬⓭⓮⓯ ⓰⓱⓲⓳⓴⓵⓶⓷⓸⓹⓺⓻⓼⓽⓾⓿ 🄀🄁🄂🄃🄄🄅🄆🄇🄈🄉🄊 🄐🄑🄒🄓🄔🄕🄖🄗🄘🄙🄚🄛🄜🄝🄞🄟 🄠🄡🄢🄣🄤🄥🄦🄧🄨🄩🄪🄫🄬🄭🄮 🄰🄱🄲🄳🄴🄵🄶🄷🄸🄹🄺🄻🄼🄽🄾🄿 🅀🅁🅂🅃🅄🅅🅆🅇🅈🅉🅊🅋🅌🅍🅎🅏 🅐🅑🅒🅓🅔🅕🅖🅗🅘🅙🅚🅛🅜🅝🅞🅟 🅠🅡🅢🅣🅤🅥🅦🅧🅨🅩🅪🅫 🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿 🆀🆁🆂🆃🆄🆅🆆🆇🆈🆉🆊🆋🆌🆍🆎🆏 🆐🆑🆒🆓🆔🆕🆖🆗🆘🆙🆚|subject=enclosed}}
{{unicode/example|🍻 🎀🎁🎂🎃🎄🎅🎆🎇🎈🎉🎊🎋🎌🎍🎎🎏 🎐🎑🎒🎓 🎠🎡🎢🎣🎤🎥🎦🎧🎨🎩🎪🎫🎬🎭 💒|subject=event}}
{{unicode/example|☕ 🌽🌾🌿 🍄🍅🍆🍇🍈🍉🍊🍋🍌🍍🍎🍏 🍐🍑🍒🍓🍔🍕🍖🍗🍘🍙🍚🍛🍜🍝🍞🍟 🍠🍡🍢🍣🍤🍥🍦🍧🍨🍩🍪🍫🍬🍭🍮🍯 🍰🍱🍲🍳🍴🍵🍶🍷🍸🍹🍺🍻🍼|subject=food}}
{{unicode/example|☖☗ ♔♕♖♗♘♙♚♛♜♝♞♟ ♠♡♢♣♤♥♦♧ ⚀⚁⚂⚃⚄⚅⚆⚇⚈⚉ ⛀⛁⛂⛃ ⛉⛊⛋ ✊✋✌ ❌ ⭕ 🀀🀁🀂🀃🀄🀅🀆🀇🀈🀉🀊🀋🀌🀍🀎🀏 🀐🀑🀒🀓🀔🀕🀖🀗🀘🀙🀚🀛🀜🀝🀞🀟 🀠🀡🀢🀣🀤🀥🀦🀧🀨🀩🀪🀫 🀰🀱🀲🀳🀴🀵🀶🀷🀸🀹🀺🀻🀼🀽🀾🀿 🁀🁁🁂🁃🁄🁅🁆🁇🁈🁉🁊🁋🁌🁍🁎🁏 🁐🁑🁒🁓🁔🁕🁖🁗🁘🁙🁚🁛🁜🁝🁞🁟 🁠🁡🁢🁣🁤🁥🁦🁧🁨🁩🁪🁫🁬🁭🁮🁯 🁰🁱🁲🁳🁴🁵🁶🁷🁸🁹🁺🁻🁼🁽🁾🁿 🂀🂁🂂🂃🂄🂅🂆🂇🂈🂉🂊🂋🂌🂍🂎🂏 🂐🂑🂒🂓 🂠🂡🂢🂣🂤🂥🂦🂧🂨🂩🂪🂫🂬🂭🂮 🂱🂲🂳🂴🂵🂶🂷🂸🂹🂺🂻🂼🂽🂾 🃁🃂🃃🃄🃅🃆🃇🃈🃉🃊🃋🃌🃍🃎🃏 🃑🃒🃓🃔🃕🃖🃗🃘🃙🃚🃛🃜🃝🃞🃟 🎮🎯🎰🎱🎲🎳🎴|subject=game}}
{{unicode/example|⌘ ♨ ♿ ⚐⚑⚒⚓⚔ ⚛ ⛌⛍ ⛏ ⛐⛑⛒⛓⛔⛕⛖⛗⛘⛙⛚⛛⛜⛝⛞⛟ ⛠⛡ ⛣ ⛨⛩⛪⛫⛬⛭⛮⛯ ⛰⛱⛲⛳⛴⛵⛶⛷⛸⛹⛺⛻⛼⛽⛾⛿ ✈ 🌋 🌍🌎🌏🌐 🍴 🏠🏡🏢🏣🏤🏥🏦🏧🏨🏩🏪🏫🏬🏭🏮🏯🏰 🗻🗼🗽🗾🗿 🚀🚁🚂🚃🚄🚅🚆🚇🚈🚉🚊🚋🚌🚍🚎🚏 🚐🚑🚒🚓🚔🚕🚖🚗🚘🚙🚚🚛🚜🚝🚞🚟 🚠🚡🚢🚣🚤🚥🚦🚧🚨🚩🚪🚫🚬🚭🚮🚯 🚰🚱🚲🚳🚴🚵🚶🚷🚸🚹🚺🚻🚼🚽🚾🚿 🛀🛁🛂🛃🛄🛅|subject=map}}
{{unicode/example|℞ ☠ ☤ ⚕ ⛨ ✚ 🅰🅱 🅾 🆎 🏥 💉💊|subject=medicine}}
{{unicode/example|$ ¢£¤¥ ƒ ؋ ৲৳ ૱ ௹ ฿ ៛ ₠₡₢₣₤₥₦₧₨₩₪₫€₭₮₯ ₰₱₲₳₴₵₶₷₸₹₺ ℳ 元 円 圆 圓 ﷼ ﹩ $ 🏦🏧 💰💱💲💳💴💵💶💷💸💹 📈📉📊|subject=money}}
{{unicode/example||subject=music}}
{{unicode/example|👤👥👦👧👨👩👪👫👬👭👮👯 👰👱👲👳👴👵👶👷👸👹👺👻👼👽👾👿 💀💁💂💃 💑 🙋🙌🙍🙎🙏|subject=person}}
{{unicode/example|☓ ☚☛☜☝☞☟ ☤ ♲♳♴♵♶♷♸♹♺♻♼♽♾♿ ⚐⚑⚒⚓⚔⚕⚖⚗⚘⚙⚚⚛⚜⚝⚞⚟ ⚢⚣⚤⚥⚦⚧⚨⚩⚪⚫⚬⚭⚮⚯ ⚰⚱⚲ ⚿ ✁✂✃✄✅ ✊✋✌✍✎✏ ✐✑✒✓✔✕✖ ✛✜ ✢✣✤✥✦✧✨✩✪✫✬✭✮✯ ✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿ ❀❁❂❃❄❅❆❇❈❉❊❋ 🌂🌃🌄🌅🌆🌇🌈🌉🌊🌋🌌 👀 👂👃👄👅👆👇👈👉👊👋👌👍👎👏 👐👑👒👓👔👕👖👗👘👙👚👛👜👝👞👟 👠👡👢👣 💄💅💆💇💈💉💊💋💌💍💎💏 💐 💠💡💢💣💤💥💦💧💨💩💪💫💬💭 💺 💼 📁📂📃📄📅📆📇📈📉📊📋📌📍📎📏 📐📑📒📓📔 📛📜 🔅🔆🔇🔈🔉🔊🔋🔌🔍🔎🔏 🔐🔑🔒🔓🔔🔕🔖🔗🔘 🔥🔦🔧🔨🔩🔪🔫🔬🔭🔮🔯 🔰🔱|subject=picto}}
{{unicode/example|☘ 🌰🌱🌲🌳🌴🌵 🌷🌸🌹🌺🌻🌼🌽🌾🌿 🍀🍁🍂🍃🍄🍅🍆🍇🍈🍉🍊🍋🍌🍍🍎🍏 🍐🍑🍒🍓|subject=plant}}
{{unicode/example||subject=politics|note=projected}}<!-- future -->
{{unicode/example|🇦🇧🇨🇩🇪🇫🇬🇭🇮🇯 🇰🇱🇲🇳🇴🇵🇶🇷🇸🇹🇺🇻🇼🇽🇾🇿 (🇨🇳 🇩🇪 🇪🇸 🇫🇷 🇬🇧 🇮🇹 🇯🇵 🇰🇷 🇷🇺 🇺🇸)|subject=region}}
{{unicode/example||subject=religion|note=projected}}<!-- future -->
{{unicode/example|⚽⚾ ⛳ ⛷⛸⛹ 🎯 🎳 🎽🎾🎿🏀🏁🏂🏃🏄 🏆🏇🏈🏉🏊|subject=sport}}
{{unicode/example|⌁ ⌐⌑ ⌕ ⌘⌙⌚⌛ ⌤⌥⌦⌧⌨ ⌫ ⍻ ⍽⍾⍿ ⎀⎁⎂⎃⎄⎅⎆⎇⎈⎉⎊⎋⎌⎍⎎⎏ ⎐⎑⎒⎓⎔ ⎖⎗⎘⎙⎚ ⏎⏏ ⏚⏛ ⏦⏧⏨⏩⏪⏫⏬⏭⏮⏯ ⏰⏱⏲⏳ ␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏ ␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟ ␠␡␢␣␤␥␦ ☎☏ ✇ 💻 💽💾💿📀 📞📟📠📡 📧 📱📲📳📴📵📶📷 📹📺📻📼|subject=technology}}
{{unicode/example|⌚⌛ ⏰⏱⏲⏳ 🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕜🕝🕞🕟🕠🕡🕢🕣🕤🕥🕦🕧|subject=time}}
{{unicode/example|⌘ ⌚⌛ ⌤⌥⌦⌧⌨ ⌫ ⎀⎁⎂⎃⎄⎅⎆⎇⎈⎉⎊⎋⎌ ⎖⎗⎘⎙⎚ ⏎⏏ ⏩⏪⏫⏬⏭⏮⏯⏰⏱⏲⏳ 🔀🔁🔂🔃🔄🔅🔆🔇🔈🔉🔊🔋🔌🔍🔎🔏 🔐🔑🔒🔓🔔🔕🔖🔗🔘🔙🔚🔛🔜🔝 🔠🔡🔢🔣🔤|subject=ui}}
{{unicode/example|! ? ‼‽ ⁇⁈⁉ ☠☡☢☣ ⚛ ⚠⚡ ⛐ ⛔ ⛚ 💣 💥 🚧 🚫 🚭 🚯 🚱 🚳 🚷|subject=warning}}
{{unicode/example|☀☁☂☃ ☇☈ ☔ ☼ ⛄⛅⛆⛇⛈ ❄❅❆ 🌀🌁🌂|subject=weather}}
|}
 
== Purpose ==
 
This template was created to allow easy switching to [[Unicode font]]s. It helps some browsers in which characters which do not render correctly, such as [[Microsoft]] [[Internet Explorer]] on [[Windows XP]].
 
The fonts selected are designed to maximize the probability of rendering uncommon [[Unicode]] characters correctly. However, different fonts cover different [[Mapping of Unicode characters|Unicode ranges]]. It is probably mostly useful for various [[Unicode symbols]]. Do not use it for the following:
 
* For strings in the [[International Phonetic Alphabet]], use {{tl|IPA}}.
* For various non-Latin scripts, use {{tl|lang}} if possible, or {{tl|script}} otherwise.
 
== Internals ==
 
The source for the template is:
<source lang="XML">
<span class="Unicode{{#if:{{{subject|}}}|{{ucfirst:{{lc:{{{subject}}}}}}}}}">{{{1}}}</span>
</source>
and <code>class="Unicode"</code> is defined in [[MediaWiki:Common.js]] as follows:
<source lang="CSS">
.Unicode {
font-family: "Arial Unicode MS", "Lucida Sans Unicode";
}
</source>
Note it defines this ''only'' for Windows XP.
 
You can override this with your own <code>Unicode</code> class definition in your [[Help:User_style|personal stylesheet]] (e.g. <tt>User:''username''/common.css</tt>).
 
The <code>Unicode''Subject''</code> classes are defined in [[MediaWiki:Common.css]] for all browsers.
 
== See also ==
 
* {{tl|IPA}} – To format symbols of the International Phonetic Alphabet
* {{tl|PUA}} – To mark characters from the Private Use Area that should be retained
* {{tl|transl}} – Generic [[romanization]]
* {{tl|script}} – Scripts in Unicode navigation box
* {{tl|UnicodeTitle}}
* {{tl|unichar}} – to format an [[Unicode]] character description
 
{{Unicode templates}}
 
<includeonly>
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:MSIE font fix templates|{{PAGENAME}}]]
[[Category:Unicode templates]]
</includeonly>