From Wikipedia, the free encyclopedia
Jump to: navigation, search


Template documentation[view] [edit] [history] [purge]


{{UTF-8|code point|base=}}

Takes a single Unicode code point and returns the UTF-8 byte encoding.

Code Point - a Unicode code point scalar value, without the "U+".

Base - template returns UTF-8 bytes in upper case hexadecimal by default. Base = Dec or 10 outputs decimal values for UTF-8 bytes. Base = LChex, LC16, Lower Case Hex, or Lower Case 16 will output hex codes in lower case.

All inputs are case insensitive.


  • {{UTF-8|1bc15}} = F0 9B B0 95
  • {{UTF-8|bc15}} = EB B0 95
  • {{UTF-8|715}} = DC 95
  • {{UTF-8|15}} = 15
  • {{UTF-8|715|base=LChex}} = dc 95
  • {{UTF-8|715|base=dec}} = 220 149


This template makes use of the following sub-templates:

  • {{UTF-8/main}} - calls other sub templates, based on options and the format of the UTF-8 sequence
  • {{UTF-8/1}} - the last byte of multi-byte UTF-8 sequences, and the only byte of a single-byte UTF-8 sequence.
  • {{UTF-8/2}} - the first byte of two-byte sequences, and second to last of 3- and 4-byte UTF-8 sequences.
  • {{UTF-8/3}} - the first byte of three-byte sequences, and the second byte of 4-byte UTF-8 sequences.
  • {{UTF-8/4}} - the first byte of four-byte sequences.

This template is dependent on the following transcluded templates:

and the magic words / parser functions padleft:, #ifexpr:, #expr:, #switch:, uc:, and lc:.

See also[edit]