Skip to content

Normalize broadcast symbols for the Wii font - #3

Merged
ColinGamez merged 1 commit into
mainfrom
agent/wii-safe-broadcast-symbols
Jul 23, 2026
Merged

Normalize broadcast symbols for the Wii font#3
ColinGamez merged 1 commit into
mainfrom
agent/wii-safe-broadcast-symbols

Conversation

@ColinGamez

@ColinGamez ColinGamez commented Jul 23, 2026

Copy link
Copy Markdown
Owner

What changed

  • convert supplementary enclosed broadcast symbols to readable BMP text such as [字], [再], and [解]
  • omit unsupported supplementary emoji rather than emitting surrogate question marks
  • use 番組情報なし for upstream placeholder titles containing only whitespace
  • reject any supplementary characters that survive collection

Why

TV no Tomo's Wii-era font renders supplementary Unicode characters as two question-mark boxes. This keeps titles and descriptions readable without changing the native data path.

Checks

  • rebuilt and validated all 54 areas and 14,871 programs
  • confirmed zero supplementary characters remain in the national feed
  • verified live Gunma EPG and string delivery byte-for-byte

Summary by Sourcery

Normalize program titles and descriptions to avoid Wii-unsupported supplementary characters in the HBNJ guide data pipeline.

Bug Fixes:

  • Strip or replace supplementary broadcast symbols in titles and descriptions with Wii-readable text to prevent unreadable surrogate characters.
  • Ensure placeholder titles consisting only of whitespace are replaced with 番組情報なし.
  • Fail validation if any Wii-unsupported supplementary characters remain in program titles or descriptions.

Enhancements:

  • Add a Wii-safe text normalization helper to compact and normalize broadcast symbols in collected guide data.

@ColinGamez
ColinGamez marked this pull request as ready for review July 23, 2026 19:12
@ColinGamez
ColinGamez merged commit efdf80b into main Jul 23, 2026
3 checks passed
@sourcery-ai

sourcery-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Reviewer's Guide

Normalize HBNJ program titles/descriptions for Wii-era font limitations by introducing a Wii-safe text sanitizer in collection and enforcing validation that rejects supplementary Unicode characters in the generated guide.

Flow diagram for Wii-safe text normalization and validation

flowchart LR
    subgraph Collection_collect_hbnj_region
        A[Raw HBNJ title/description] --> B[compact_text]
        B --> C[wii_safe_text]
        C -->|empty after wii_safe_text| D[Set title to 番組情報なし]
        C -->|non-empty| E[Persist title/description in guide JSON]
    end

    subgraph Validation_validate_hbnj_guide
        E --> F[main]
        F --> G[Iterate programs]
        G --> H["Scan title for ord(character) > 0xFFFF"]
        G --> I["Scan description for ord(character) > 0xFFFF"]
        H -->|supplementary found| J[fail with Wii-unsupported codes]
        I -->|supplementary found| J
        H -->|none| K[Accept title]
        I -->|none| L[Accept description]
    end
Loading

File-Level Changes

Change Details Files
Introduce Wii-safe text normalization to strip or normalize supplementary broadcast symbols before persisting titles and descriptions.
  • Add a wii_safe_text helper that drops non-BMP characters, normalizes compatible supplementary broadcast symbols via NFKC, wraps them in brackets, and trims whitespace
  • Invoke Wii-safe normalization on parsed titles, falling back to a standard placeholder when the result is empty
  • Invoke Wii-safe normalization on parsed descriptions so they no longer contain unsupported supplementary characters
tools/collect_hbnj_region.py
Tighten guide validation to reject titles/descriptions containing Wii-unsupported supplementary Unicode characters.
  • Scan program titles and descriptions for code points above U+FFFF to detect supplementary characters
  • Fail validation with a clear error message including up to three offending code points when supplementary characters are found
tools/validate_hbnj_guide.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ColinGamez
ColinGamez deleted the agent/wii-safe-broadcast-symbols branch July 23, 2026 19:12

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider extracting the supplementary-character validation logic in validate_hbnj_guide.py into a small helper (e.g., assert_wii_safe(field_name, value, program_id)) so the title/description loop is easier to read and can be reused or extended consistently later.
  • In wii_safe_text, you currently re-normalize whitespace with re.sub(r"\s+", " ", ...) even though compact_text already does this; if the function is always called on compacted text, you could skip this second pass to avoid subtly changing inputs that might not have been compacted first.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting the supplementary-character validation logic in `validate_hbnj_guide.py` into a small helper (e.g., `assert_wii_safe(field_name, value, program_id)`) so the title/description loop is easier to read and can be reused or extended consistently later.
- In `wii_safe_text`, you currently re-normalize whitespace with `re.sub(r"\s+", " ", ...)` even though `compact_text` already does this; if the function is always called on compacted text, you could skip this second pass to avoid subtly changing inputs that might not have been compacted first.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant