From 2cf1521b5f0a5ed6f086ad9b2beb2a6ef8bfc1ec Mon Sep 17 00:00:00 2001 From: WXbet <57314510+WXbet@users.noreply.github.com> Date: Wed, 22 Apr 2026 00:27:50 +0200 Subject: [PATCH] [Tools] Strip DVB control bytes from EXAMPLE CustomLCN descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sky DE wraps service names in DVB emphasis bytes (0x86/0x87 in the C1 control range) around the actual text, on top of a leading charset indicator (0x05 in the C0 range). The SDT parser in dvbreader.c only strips the first leading control byte, so service names like "\x05\x86Sky\x87 \x86Showcase\x87" reach the CustomLCN writer as "\x86Sky\x87 \x86Showcase\x87" after six.ensure_text decodes them to Unicode (U+0086 / U+0087). Those codepoints then appear as UTF-8 "\xc2\x86" / "\xc2\x87" pairs in the generated EXAMPLE_*_CustomLCN.xml files — unreadable garbage for maintainers opening the file in an editor. Strip every C0 and C1 control character (U+0000..U+001F, U+007F..U+009F) from the description before writing, using the already-imported re module. No effect on the runtime service name used in bouquets, only on what ABM writes into its example files. --- AutoBouquetsMaker/src/scanner/tools.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AutoBouquetsMaker/src/scanner/tools.py b/AutoBouquetsMaker/src/scanner/tools.py index 0156d8fc..2bd7af00 100644 --- a/AutoBouquetsMaker/src/scanner/tools.py +++ b/AutoBouquetsMaker/src/scanner/tools.py @@ -60,6 +60,12 @@ def customLCN(self, services, section_identifier, current_bouquet_key): servicename = unicode(services[type][number]["service_name"], errors='ignore') # noqa: F821 else: servicename = six.ensure_text(services[type][number]["service_name"], encoding='utf-8', errors='ignore') + # Strip DVB control bytes from the description so generated EXAMPLE + # CustomLCN files show clean readable names. Covers both the C0 range + # (charset indicators like 0x05) and the C1 range (DVB emphasis + # 0x86 / 0x87, which Sky DE wraps around channel-name fragments + # and which six.ensure_text has already decoded to U+0086 / U+0087). + servicename = re.sub(r"[\x00-\x1f\x7f-\x9f]", "", servicename) service_id = services[type][number]["service_id"] channel_id = ("channelid=\"%d\" " % services[type][number]["channel_id"]) if "channel_id" in services[type][number] else "" xml_out_list.append("\t\t\n" % (