Translate between text characters and numeric code points.
Formula
Map characters to Unicode/ASCII code points (and the reverse)
Explanation
Each character has a Unicode scalar value. ASCII is the 0–127 subset. Conversion is a table lookup in both directions; multi-byte UTF-8 encoding is a separate serialization of the same code points.
Variables
characterthe glyph/text unit
code pointinteger identity in Unicode (or ASCII subset)
When to use
Debugging encodings, escape sequences, and character-set conversions.