Coverage for src/susi/utils/encoding.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2025-08-11 10:03 +0000

1 

2import sys 

3 

4 

5class Unicode: 

6 """ 

7 Unicode encoding helper 

8 """ 

9 

10 #: Dict to map non-printable characters to None 

11 TRANS_TABLE = {i: None for i in range(0, sys.maxunicode + 1) if not chr(i).isprintable()} 

12 

13 @staticmethod 

14 def print_save(string: str) -> str: 

15 """Remove all non-printable characters from the string.""" 

16 string.translate(Unicode.TRANS_TABLE) 

17 return string