Use platform neutral line separator(s)
To at least try to support things like windows it's better if we can make an attempt to use the platform neutral characters for line separator(s) where appropriate. Change-Id: Icc533ed4d4c94f461b7f19600b74146221f17b18
This commit is contained in:
committed by
Joshua Harlow
parent
ab71a2677d
commit
42a665d06f
@@ -142,6 +142,11 @@ def clamp(value, minimum, maximum, on_clamped=None):
|
||||
return value
|
||||
|
||||
|
||||
def fix_newlines(text, replacement=os.linesep):
|
||||
"""Fixes text that *may* end with wrong nl by replacing with right nl."""
|
||||
return replacement.join(text.splitlines())
|
||||
|
||||
|
||||
def binary_encode(text, encoding='utf-8'):
|
||||
"""Converts a string of into a binary type using given encoding.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user