• src/encode/utf8.c

    From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Wednesday, July 29, 2026 23:14:42
    https://gitlab.synchro.net/main/sbbs/-/commit/b1e66e262afaa7bc665a79b8
    Modified Files:
    src/encode/utf8.c
    Log Message:
    utf8: normalize EM DASH to a pair of ASCII hyphens

    utf8_normalize_str() folded U+2010 HYPHEN, U+2011 NON-BREAKING HYPHEN,
    U+2012 FIGURE DASH and U+2013 EN DASH to '-', but left U+2014 EM DASH
    alone. It fell through to unicode_to_cp437() instead and reached CP437 terminals as 0xC4, the box-drawing horizontal rule, which reads as a line rather than a dash in running prose - and is not ASCII at all for a
    US-ASCII terminal.

    Emit two hyphens, the conventional ASCII rendering of an em dash. The substitution consumes three bytes and writes two, so the in-place rewrite
    still never overtakes its source; HORIZONTAL ELLIPSIS, at three bytes to
    three characters, remains the tightest case in the function.

    U+2015 HORIZONTAL BAR is deliberately left alone: unicode_to_cp437()
    groups it with the box-drawing characters, for which CP437 0xC4 is an
    exact match rather than a fallback.

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Wednesday, July 29, 2026 23:14:42
    https://gitlab.synchro.net/main/sbbs/-/commit/3b412fa2e195fe1e0a3a8cb1
    Modified Files:
    src/encode/utf8.c
    Log Message:
    utf8: make utf8_to_cp437_str() actually convert

    The function looked up every codepoint with unicode_to_cp437() and
    skipped any that returned zero. That function is a table of approximations
    for codepoints CP437 cannot represent directly, so it returns zero for all
    of U+0020 through U+007E - meaning every ASCII character was discarded and "Hello, world!" converted to an empty string. It also asked utf8_getc()
    for a character while passing the space remaining in the destination as
    the number of readable source bytes, and ignored 'minval' entirely.

    Convert the way print_utf8_as_cp437() does: pass ASCII straight through
    (CP437 and ASCII agree below 0x80), then prefer an exact match from cp437_unicode_tbl before falling back to the unicode_to_cp437()
    approximation, and emit an inverted question mark for what remains rather
    than dropping it. Codepoints below 'minval' are left untranslated, as in cp437_to_utf8_str(). utf8_getc() is now given the remaining source length.

    The function has had no callers since it was added, which is why none of
    this surfaced.

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net