Compare commits

..

No commits in common. "ee7d0e9e08d4349a48ec6c50030a0a48509d0ae4" and "ef25cc15f70115935c2dedd46166aa97446ad54a" have entirely different histories.

5 changed files with 2 additions and 50044 deletions

View File

@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="Python 3.8" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project>

View File

@ -1,25 +0,0 @@
import re
import sys
def binary_to_utf8(binary_string):
# padding = 8 - len(binary_string) % 8
# binary_string += '0' * padding
# binary_string = binary_string.rstrip('0')
bytes_list = [binary_string[i:i+8] for i in range(0, len(binary_string), 8)]
decimal_list = [int(byte, 2) for byte in bytes_list]
bytes = bytearray(decimal_list)
try:
utf8_text = bytes.decode('utf-8')
except UnicodeDecodeError:
utf8_text = bytes.decode('utf-8', errors='replace')
return utf8_text
return utf8_text
for line in sys.stdin:
result = binary_to_utf8(line.strip())
print(result.encode('utf-8'))

File diff suppressed because one or more lines are too long

View File

@ -1,17 +0,0 @@
import sys
import binascii
def hex_to_utf8(hex_string):
hex_string = hex_string.replace(' ', '').replace('0x', '')
bytes_data = binascii.unhexlify(hex_string)
try:
utf8_text = bytes_data.decode('utf-8')
except UnicodeDecodeError:
utf8_text = bytes_data.decode('utf-8', errors='replace')
return utf8_text
for line in sys.stdin:
result_text = hex_to_utf8(line.strip())
print(result_text.encode('utf-8'))