script: count UTF-8 characters when validating BIP titles #2357

pull unixglo wants to merge 1 commits into bitcoin:master from unixglo:master changing 3 files +75 −1
  1. unixglo commented at 9:50 AM on November 15, 2026: none

    BIP 3 limits the Title header to 50 characters. However, buildtable.pl reads the preamble without decoding UTF-8, so length() counts bytes and rejects some titles within that limit.

    For example, the existing BIP 450 title, Formosa—Seed encoding by themed mnemonic stories, contains 48 characters and 50 UTF-8 bytes. Appending ! produces 49 characters but 51 bytes, which the current validator rejects:

    bip-0450.mediawiki has too-long Title (51 > 50 char max)

    Decode UTF-8 only for the length check. Use FB_CROAK to reject malformed UTF-8 and LEAVE_SRC to preserve the original title bytes for table output.

    Add regression tests for both MediaWiki and Markdown preambles, covering ASCII and UTF-8 length boundaries, the BIP 450 example, malformed UTF-8, and preservation of output bytes. Run these tests in the existing Build-Table-Checks job.

    Validation:

    • prove scripts/buildtable.t — all 24 subtests pass.
    • perl -c scripts/buildtable.pl
    • scripts/link-format-chk.sh
    • scripts/diffcheck.sh
    • typos
    • Generated table output and diagnostics for all existing BIPs are byte-for-byte identical before and after the change.
  2. script: count UTF-8 characters when validating BIP titles
    Signed-off-by: unixglo <unixunit@outlook.com>
    dbc08028dd
  3. murchandamus changes_requested
  4. murchandamus commented at 6:12 PM on November 18, 2026: member

    The change makes sense to me and seems correct. The existing BIPs are encoded either in pure ASCII or UTF-8, so the strict failure should be fine. However, I don’t think we need the test here, could you please reduce the PR to just the changes to buildtable.pl?

  5. jonatack added the label PR Author action required on Nov 19, 2026
  6. jonatack added the label CI on Nov 19, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-11-24 00:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me