Template:Chrfn/doc

Character from Number: inverse of Template:Nfchr, decodes a character from an integer in the range 1 - 99.

  • 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
    a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~

  • 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
    ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
  • 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
    @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _
  • 96 97 98 99
    ± × é •

One list:

abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_±×é•

32-95 is ASCII, 1-30 is ASCII 97-126, 31 is newline, and 96-99 are miscellaneous.

0 produces the empty string, so that digit strings with the same numerical value, e.g. 006502 and 6502, produce the same string (in this case Ab). Thus 99 characters are supported.

To avoid an automatic newline, the characters #*:; are returned inside <nowiki> tags.

Examples:

  • "{{chrfn|5}}" → "e" [1]
  • "{{chrfn|05}}" → "e" [2]

Special cases:

  • "{{chrfn|0}}" → "" [3]
  • "{{chrfn|}}" → "" [4]
  • "{{chrfn}}" → "" [5]
  • "{{chrfn|32}}" → " " [6]
  • "{{chrfn|31}}" → "

" [7]

Example with invalid number:

  • "{{chrfn|a3}}" → "˚" [8]

Example with unsupported value:

  • "{{chrfn|100}}" → "˚" [9]

Supported charactersEdit

The supported characters are a core character set of 95 characters and four other characters ( ± × • é ).

The core character set consists of the basic letters or digits (62), and all characters with a special meaning in MediaWiki (including extensions on Wikimedia wikis), HTML, JavaScript, URLs, and/or email-addresses (33):

space newline {  |  }  ~  !  "  #  $  %  &  '  (  )  *  +  ,  -  .  /  :  ;  <  =  >  ?  @  [  \  ]  ^  _

All magic words in the English version of MediaWiki, and even in many other versions since they are often not translated, use the core character set only. Some language versions allow both English and local magic words, which may or may not contain unsupported characters, see e.g. [10], [11]. Results from formatnum may even contain local digits, which are not in this character set.

Parameter namesEdit

All 99 characters can be used in a parameter name:

{{pp|1=abcdefghijklmnopqrstuvwxyz{ {{!}} }~ 
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_±×•é|abcdefghijklmnopqrstuvwxyz{ {{!}} }~ 
!"#$%&'()*+,-./0123456789:;<{{=}}>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_±×•é=q}}

gives q.

Page titlesEdit

Not allowed are: # < > [ ] | { } newline

The space and _ are the same.

For + & % . there are restrictions and complications; not allowed at the start is ":".

Example: abcdefghijklmnopqrstuvwxyz~ !"$'()*,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\^_±×•é

For the first character, a-z are capitalized.

Checking all characters for allowing a page title consisting of p, the character, and q:

[[paq]] [[pbq]] [[pcq]] [[pdq]] [[peq]] [[pfq]] [[pgq]] [[phq]] [[piq]] [[pjq]] [[pkq]] [[plq]] [[pmq]] [[pnq]] [[poq]] [[ppq]] [[pqq]] [[prq]] [[psq]] [[ptq]] [[puq]] [[pvq]] [[pwq]] [[pxq]] [[pyq]] [[pzq]] [[p{q]] [[p|q]] [[p}q]] [[p~q]] [[p q]] [[p q]] [[p!q]] [[p"q]] [[p#q]] [[p$q]] [[p%q]] [[p&q]] [[p'q]] [[p(q]] [[p)q]] [[p*q]] [[p+q]] [[p,q]] [[p-q]] [[p.q]] [[p/q]] [[p0q]] [[p1q]] [[p2q]] [[p3q]] [[p4q]] [[p5q]] [[p6q]] [[p7q]] [[p8q]] [[p9q]] [[p:q]] [[p;q]] [[p<q]] [[p=q]] [[p>q]] [[p?q]] [[p@q]] [[pAq]] [[pBq]] [[pCq]] [[pDq]] [[pEq]] [[pFq]] [[pGq]] [[pHq]] [[pIq]] [[pJq]] [[pKq]] [[pLq]] [[pMq]] [[pNq]] [[pOq]] [[pPq]] [[pQq]] [[pRq]] [[pSq]] [[pTq]] [[pUq]] [[pVq]] [[pWq]] [[pXq]] [[pYq]] [[pZq]] [[p[q]] [[p\q]] [[p]q]] [[p^q]] [[p_q]] [[p±q]] [[p×q]] [[péq]] [[p•q]]

Such page titles are allowed for 90 of the 99 characters. They are not allowed for {|}#<>[] and newline, which are not allowed at all in page titles. The automatic procedure seems to show that p*q, p:q and p;q are not allowed either, but this is because the automatic newline feature/bug inserts a newline.

Checking these 90 characters for allowing a page title consisting of 3 of them:

[[aaa|a]] [[bbb|b]] [[ccc|c]] [[ddd|d]] [[eee|e]] [[fff|f]] [[ggg|g]] [[hhh|h]] [[iii|i]] [[jjj|j]] [[kkk|k]] [[lll|l]] [[mmm|m]] [[nnn|n]] [[ooo|o]] [[ppp|p]] [[qqq|q]] [[rrr|r]] [[sss|s]] [[ttt|t]] [[uuu|u]] [[vvv|v]] [[www|w]] [[xxx|x]] [[yyy|y]] [[zzz|z]] [[~~~|~]] [[ | ]] [[!!!|!]] [["""|"]] [[$$$|$]] [[%%%|%]] [[&&&|&]] [['''|']] [[(((|(]] [[)))|)]] [[+++|+]] [[,,,|,]] [[---|-]] [[...|.]] [[///|/]] [[000|0]] [[111|1]] [[222|2]] [[333|3]] [[444|4]] [[555|5]] [[666|6]] [[777|7]] [[888|8]] [[999|9]] [[===|=]] [[???|?]] [[@@@|@]] [[AAA|A]] [[BBB|B]] [[CCC|C]] [[DDD|D]] [[EEE|E]] [[FFF|F]] [[GGG|G]] [[HHH|H]] [[III|I]] [[JJJ|J]] [[KKK|K]] [[LLL|L]] [[MMM|M]] [[NNN|N]] [[OOO|O]] [[PPP|P]] [[QQQ|Q]] [[RRR|R]] [[SSS|S]] [[TTT|T]] [[UUU|U]] [[VVV|V]] [[WWW|W]] [[XXX|X]] [[YYY|Y]] [[ZZZ|Z]] [[\\\|\]] [[^^^|^]] [[___|_]] [[±±±|±]] [[×××|×]] [[ééé|é]] [[•••|•]]

and testing separately: *** [[:::]] ;;;

Thus such page titles are allowed for 85 of the 90 remaining characters. They are not allowed for ~': and spaces/underscores.

For these 85 characters, checking for allowing even a page title consisting of 86 of them:

#invoke:For

and testing separately: ************************************************************************************** ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Thus, from these characters, only for • it is not allowed. This is because it takes 3 bytes, so 86 of them exceeds 255 bytes.

For the remaining 84 characters, checking for allowing even a page title consisting of 128 of them:

Template:For

and testing separately: ******************************************************************************************************************************** ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Thus, from these characters, it is not allowed for ± × é. This is because they take 2 bytes, so 128 of them exceeds 255 bytes.

The remaining 81 characters allow 255 of them in a page title. Of these 75 can be used in page titles without restrictions and are not affected by the automatic newline feature/bug: a b c d e f g h i j k l m n o p q r s t u v w x y z ! " $ ( ) , - / 0 1 2 3 4 5 6 7 8 9 = ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \ ^

The slash forms the separator for #titleparts, the other 74 characters can freely be used in the up to 25 substrings which can be individually retrieved by #titleparts, with the understanding that when retrieving the first string it capitalizes the first character.

For the period the only limitation is that . and .. are not allowed as substring, so numbers with a dot can be used as or inside substrings.

See Help:Page name.

Relation with Template:SubEdit

Template:Sub supports all the 99 characters and more. Comparing {{chrfn|{{{1}}}}} with {{chr|p{{chrfn|{{{1}}}}}|2}}:

#tag:nowiki

For the characters 35, 42, 58 and 59 the <nowiki> tags produced by chrfn are internally replaced by a code. The function padleft shows the first character in the four cases:

Thus with chr we get the "unsupported" sign.

However, {{chr|p#|2}}{{chr|p*|2}}{{chr|p:|2}}{{chr|p;|2}} gives Template:ChrTemplate:ChrTemplate:ChrTemplate:Chr, so chr works for these characters also, just not if they are inside <nowiki> tags.

JavaScript sortingEdit

See Template:Chrfn/sorting.

See alsoEdit