tessl install tessl/pypi-python-bidi@0.6.0Python Bidi layout wrapping the Rust crate unicode-bidi
Agent Success
Agent success rate when using this tile
93%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.09x
Baseline
Agent success rate without this tile
85%
Build a text processor that handles bidirectional text in multiple character encodings for a legacy document conversion system.
Your solution must implement a function that processes text files containing right-to-left (RTL) content stored in various legacy encodings and prepares them for display.
Implement a function process_text_file(data, encoding_name) that:
The function should handle at least these encodings:
@generates
def process_text_file(data: bytes, encoding_name: str) -> bytes:
"""
Process bidirectional text from bytes in the specified encoding.
Args:
data: Raw bytes containing text in the specified encoding
encoding_name: The character encoding name (e.g., 'utf-8', 'cp1255', 'iso-8859-8')
Returns:
Processed bytes in the same encoding, with text reordered for display
"""
passProvides bidirectional text processing support for handling right-to-left scripts.