15 lines
No EOL
335 B
Python
15 lines
No EOL
335 B
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Utilities for handling unicode and other repetitive bits
|
|
"""
|
|
import six
|
|
|
|
def u(text, encoding='utf-8'):
|
|
"Return unicode text, no matter what"
|
|
|
|
if isinstance(text, six.binary_type):
|
|
text = text.decode(encoding)
|
|
|
|
# it's already unicode
|
|
text = text.replace('\r\n', '\n')
|
|
return text |