Skip to content

Commit c785e9c

Browse files
author
Kazuki Suzuki Przyborowski
authored
Update pycatfile.py
1 parent 9c951fe commit c785e9c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pycatfile.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,13 @@ def __exit__(self, exc_type, exc_value, traceback):
15301530
self.close()
15311531

15321532

1533+
def ConvertEncoding(text, from_encoding, to_encoding):
1534+
"""Converts a string from one encoding to another."""
1535+
decoded_text = text.decode(from_encoding)
1536+
encoded_text = decoded_text.encode(to_encoding)
1537+
return encoded_text
1538+
1539+
15331540
def TarFileCheck(infile):
15341541
try:
15351542
if is_tarfile(infile):

0 commit comments

Comments
 (0)