Reputation: 3322
I have a friend that's been using the jQuery Keypad plugin. He now needs superscripts (and/or perhaps subscripts) of several characters. Does anyone know how to make or find (copy/paste) the following superscript characters in UTF-8?
Superscript characters needed: nd th st rd [ ] ( )
The nd, th, st, rd are for things like 22nd, 7th, 1st, 3rd (but superscripted)
[ ] ( ) would also be needed.
The jQuery Keypad plugin is currently being used with some extra BBCode functionality.
http://keith-wood.name/keypad.html
var custom_keypad_bbcode = [
'⁰|¹|²|³|⁴|⁵|⁶|⁷|⁸|⁹|¢|£|' + $.keypad.QTAT,
'‘|’|“|”|–|—|©|®|™|¼|½|¾|' + $.keypad.ITALIC,
'à|á|â|ã|ä|å|æ|ç|è|é|ê|ë|' + $.keypad.QUOTE,
'ì|í|í|î|ï|ñ|ò|ó|ô|õ|ö|ø|' + $.keypad.ULINE,
$.keypad.SHIFT + '|ð|þ|ù|ú|û|ü|ý|ÿ|' + $.keypad.CLOSE + '|' + $.keypad.BOLD,
];
I'm thinking of using BBCode, but I would prefer to write out the characters in a UTF-8. I found the following list, but it doesn't include superscript "t" or "h".
http://www.fileformat.info/info/unicode/block/superscripts_and_subscripts/list.htm
Does anyone know how to make or find (copy/paste) the needed superscript characters in UTF-8?
Upvotes: 2
Views: 959
Reputation: 3322
Here's what I eventually came up with in PHP. Yet, the baseline for the 'nd' is not at one level.
// Testing: Superscript characters needed: nd th st rd [ ] ( )
// nd ⁿᵈ
echo "nd: ".html_entity_decode('ⁿ', ENT_COMPAT, 'UTF-8').html_entity_decode('ᵈ', ENT_COMPAT, 'UTF-8')."<br>";
// th ᵗʰ (t-x1D57) ᵗʰ (H-x2b0)
echo "th: ".html_entity_decode('ᵗ', ENT_COMPAT, 'UTF-8').html_entity_decode('ʰ', ENT_COMPAT, 'UTF-8')."<br>";
// st ˢᵗ
echo "st: ".html_entity_decode('ˢ', ENT_COMPAT, 'UTF-8').html_entity_decode('ᵗ', ENT_COMPAT, 'UTF-8')."<br>";
// rd ʳᵈ
echo "rd: ".html_entity_decode('ʳ', ENT_COMPAT, 'UTF-8').html_entity_decode('ᵈ', ENT_COMPAT, 'UTF-8')."<br>";
echo "<br><br><br>";
echo "n-".html_entity_decode('ⁿ', ENT_COMPAT, 'UTF-8');
echo "d-".html_entity_decode('ᵈ', ENT_COMPAT, 'UTF-8');
echo "h-".html_entity_decode('ʰ', ENT_COMPAT, 'UTF-8');
echo "r-".html_entity_decode('ʳ', ENT_COMPAT, 'UTF-8');
echo "s-".html_entity_decode('ˢ', ENT_COMPAT, 'UTF-8');
echo "t-".html_entity_decode('ᵗ', ENT_COMPAT, 'UTF-8');
Upvotes: 0
Reputation: 9457
Superscripts and subscripts for some characters are in the U+2070 – U+209C Unicode range:
superscript: 0456789+-=()in
subscript: 0123456789+-=aeoxhklmnpst
There's also:
subscript j
at U+2C7C
subscript iruv
at U+1D62–U+1D65
superscript 123
you have already found
and so-called "phonetic modifier letters" (which for most purposes look like superscript):
abdegkmoptuv
at U+1D43–U+1D5B
c
at U+1D9C
f
at U+1DA0
z
at U+1DBB
hjrwy
at U+02B0–U+02B8
lsx
at U+02E1–U+02E3.
So, assuming you have a font that supports all those characters and the modifier letters look similar to the superscript letters, you have the following:
superscript: all digits, all lowercase ASCII letters, and some other symbols
subscript: all digits, letters aehijklmnprstuvx
, and some other symbols
Upvotes: 1