:3
This commit is contained in:
parent
03043b2e5c
commit
aa647ec057
932 changed files with 145602 additions and 111 deletions
18
venv/lib/python3.12/site-packages/frontmatter/util.py
Normal file
18
venv/lib/python3.12/site-packages/frontmatter/util.py
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue