Title sanitization for MiniDisc TOC entries, ported from netmd-js.
Half-width titles allow ASCII plus half-width katakana; full-width
titles allow the two-byte Shift-JIS character set. Both sanitizers fall
back to an aggressive ASCII-only strip when the result would not encode
cleanly. The mapping tables are extracted verbatim from the reference
source by tools/gen_title_tables.ts.
Summary
Functions
Strip a title down to plain ASCII.
Length of a title in half-width character cells; voiced kana take two.
Convert a track range like "1-5" to its full-width form. Characters
outside 0-9, -, / and ; are dropped.
Replace diacritics with their base characters, like the diacritics package used by the reference.
Sanitize a title for the full-width (two bytes per character) TOC slot.
Sanitize a title for the half-width (ASCII and half-width kana) TOC slot.
Functions
Strip a title down to plain ASCII.
@spec half_width_length(String.t()) :: non_neg_integer()
Length of a title in half-width character cells; voiced kana take two.
Convert a track range like "1-5" to its full-width form. Characters
outside 0-9, -, / and ; are dropped.
Replace diacritics with their base characters, like the diacritics package used by the reference.
Sanitize a title for the full-width (two bytes per character) TOC slot.
With just_remap: true only the character remapping runs, without the
encoding check and fallback.
Sanitize a title for the half-width (ASCII and half-width kana) TOC slot.