Python Bidi layout wrapping the Rust crate unicode-bidi
Overall
score
93%
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.
Install with Tessl CLI
npx tessl i tessl/pypi-python-bididocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10