This commit is contained in:
Mrrp 2025-01-01 20:56:09 -08:00
parent 03043b2e5c
commit aa647ec057
932 changed files with 145602 additions and 111 deletions

View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
"""
Utilities for handling unicode and other repetitive bits
"""
from typing import AnyStr
def u(text: AnyStr, encoding: str = "utf-8") -> str:
"Return unicode text, no matter what"
if isinstance(text, bytes):
text_str: str = text.decode(encoding)
else:
text_str = text
# it's already unicode
text_str = text_str.replace("\r\n", "\n")
return text_str