Repository navigation
fix(teletext): Add --ttxtforcelatin option to force Latin G0 charset - #1821
Merged
Merged
Conversation
Some broadcast streams incorrectly signal Cyrillic character set (via X/28 or M/29 packets) when the actual content is Latin text. This causes garbled output where Latin text like "No. Not back then, anyway." appears as Cyrillic "Но. Нот бацк тхен, анiваi." This fix adds a new --ttxtforcelatin option that forces the teletext G0 character set to Latin, ignoring any Cyrillic designation in the stream. Root cause: The broadcast contained triplet 0x1290 which has bits 10-13 set to 0x1 (Cyrillic family) and bits 7-9 set to 0x5 (Ukrainian option), causing CCExtractor to use CYRILLIC3 charset instead of Latin. Usage: ccextractor input.ts --ttxtforcelatin -o output.srt Before fix (without option): Subtitle 3: Но. Нот бацк тхен, анiваi. After fix (with --ttxtforcelatin): Subtitle 3: No. Not back then, anyway. Fixes #1395 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Deepak-negi11
added a commit
to Deepak-negi11/ccextractor
that referenced
this pull request
Oct 18, 2026
The Rust port of telxcc.c (lib_ccxr/src/teletext.rs) is not called yet, and as it stands it could never produce output: - receiving_data was never set to true (C sets it at telxcc.c:1072), so every row packet was dropped - the parity check was inverted, so every valid character became a space - the line trimming loop from telxcc.c:690-701 was missing, so col_stop stayed 40 and text[row][40] panicked - a non-BCD page number (e.g. 0x7a0) indexed seen_sub_page[1000] out of bounds; read the leading digits like C's atoi() - close() dropped the last buffered page instead of outputting it Also bring over later telxcc.c changes: hide a page when the next one starts (CCExtractor#2292), honour --ttxtforcelatin (CCExtractor#1821), only print the page notice with file reports, decode Hamming 8/4 errors as 0x0f like unham_8_4(), and treat a Levenshtein distance equal to the limit as a match like fuzzy_memcmp(). Multi-page extraction is left out: CCExtractor#2356 is changing that logic in telxcc.c.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--ttxtforcelatincommand-line optionProblem
Some broadcast streams (e.g., UK Freesat recordings) incorrectly signal Cyrillic character set via X/28 or M/29 teletext packets when the actual content is Latin English text.
Before (garbled Cyrillic):
Expected (correct Latin):
Root Cause
The broadcast stream contains triplet value
0x1290which has:This causes CCExtractor to select CYRILLIC3 (Ukrainian) charset instead of Latin.
Solution
Added
--ttxtforcelatinoption that bypasses the Cyrillic character set detection and always uses Latin G0 charset.Changes
src/lib_ccx/lib_ccx.h: Addedforceg0latinfield to teletext configsrc/lib_ccx/telxcc.c: Modifiedset_g0_charset()to respectforceg0latinoptionsrc/rust/src/args.rs: Added--ttxtforcelatinCLI argumentsrc/rust/src/parser.rs: Added argument handlingsrc/rust/src/common.rs: Added field to struct conversionsrc/rust/lib_ccxr/src/teletext.rs: Addedforceg0latinto TeletextConfigTest plan
--ttxtforcelatinproduces correct Latin outputUsage
Fixes #1395
🤖 Generated with Claude Code