unicode(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– unicode β€” the normalization glow-up πŸ’–

okay bestie, so this is unicode(3tcl) β€” the Tcl manual page all about Unicode normalization ✨ and ngl it's lowkey iconic. it lives in tcllib and it's here to make your strings behave. let's get into it 🫢


✨ NAME ✨

unicode β€” implementation of Unicode normalization πŸ’…


🌸 SYNOPSIS 🌸

package require Tcl 8.5 9

package require unicode 1.1.1

::unicode::fromstring string

::unicode::tostring uclist

::unicode::normalize form uclist

::unicode::normalizeS form string

like, that's the whole vibe right there πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

this is an implementation in Tcl of the Unicode normalization forms. that's it, that's the whole thing. no cap πŸŽ€


πŸ’… COMMANDS πŸ’…

the main character energy lives here fr fr:

  • ::unicode::fromstring string β€” takes string and converts it into a list of integer Unicode character codes, which is what unicode uses for its internal string representation. so like, the ✨real✨ form of your string.
  • ::unicode::tostring uclist β€” the glow-down (but in a good way): converts that list of integers uclist back into a Tcl string. reverse uno card πŸƒ
  • ::unicode::normalize form uclist β€” normalizes the Unicode characters list ulist according to form, and hands you back the normalized list. and form can be one of these four:
    • D β€” canonical decomposition
    • C β€” canonical decomposition, followed by canonical composition
    • KD β€” compatibility decomposition
    • KC β€” compatibility decomposition, followed by canonical composition
  • ::unicode::normalizeS form string β€” the shortcut bestie!! it's literally just ::unicode::tostring [unicode::normalize $form [::unicode::fromstring $string]]. normalizes a Tcl string and returns the normalized string. normalize + string = normalizeS, iykyk 🌈

πŸ”₯ EXAMPLES πŸ”₯

watch and learn, this is the tutorial arc:

% ::unicode::fromstring "\u0410\u0411\u0412\u0413"
1040 1041 1042 1043
% ::unicode::tostring {49 50 51 52 53}
12345
%
% ::unicode::normalize D {7692 775}
68 803 775
% ::unicode::normalizeS KD "\u1d2c"
A
%

see?? it just works. slay πŸ’…


⭐ REFERENCES ⭐

  1. "Unicode Standard Annex #15: Unicode Normalization Forms", (http://unicode.org/reports/tr15/)

πŸ‘‘ AUTHORS πŸ‘‘

Sergei Golovan


πŸ’€ BUGS, IDEAS, FEEDBACK πŸ’€

okay so real talk β€” this document, and the package it describes, will undoubtedly contain bugs and other problems. like, guaranteed. so please report them in the category stringprep of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. and if you've got ideas for enhancements for either the package and/or the documentation, pls also drop those πŸ’–

when proposing code changes, please provide unified diffs, i.e the output of diff -u.

also note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. that's the move πŸ™ˆ


🧚 SEE ALSO 🧚

stringprep(3tcl)


πŸ“ KEYWORDS πŸ“

normalization, unicode


Copyright (c) 2007, Sergei Golovan <sgolovan@nes.ru>


and that's a wrap bestie!! this page came to you from tcllib, version 1.1.1, and the manual page is dated unicode(3tcl) ✨ mwah, go normalize something, you got this πŸŽ€πŸ’–

πŸ“¦ where this page comes from