TXT Output: Fix asciiize option not applying to generated inline TOC

Fixes #3051
This commit is contained in:
copilot-swe-agent[bot]
2026-03-19 02:41:28 +00:00
committed by Kovid Goyal
parent 08801be3a9
commit ee6e7d8d71
+6
View File
@@ -97,7 +97,13 @@ class TXTMLizer:
if getattr(self.opts, 'inline_toc', None):
self.log.debug('Generating table of contents...')
toc.append('{}\n\n'.format(_('Table of Contents:')))
unihandecoder = None
if getattr(self.opts, 'asciiize', False):
from calibre.utils.localization import get_udc
unihandecoder = get_udc()
for item in self.toc_titles:
if unihandecoder is not None:
item = unihandecoder.decode(item)
toc.append(f'* {item}\n\n')
return ''.join(toc)