mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Don't UnicodeDecodeError on non-ascii not-found hooks. Resolves #207.
This commit is contained in:
parent
20c546a7da
commit
7905594215
5 changed files with 35 additions and 12 deletions
|
|
@ -20,3 +20,11 @@ else: # pragma: no cover (PY3 only)
|
|||
return s
|
||||
else:
|
||||
return s.decode('UTF-8')
|
||||
|
||||
|
||||
def to_text(s):
|
||||
return s if isinstance(s, text) else s.decode('UTF-8')
|
||||
|
||||
|
||||
def to_bytes(s):
|
||||
return s if isinstance(s, bytes) else s.encode('UTF-8')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue