Skip to content

Commit 8c8357b

Browse files
committed
Fixed minor bugs
1 parent 2e53c48 commit 8c8357b

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

codext/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def main():
127127
with open(args.outfile, 'wb') as f:
128128
f.write(c)
129129
else:
130-
print(ensure_str(c or "Could not decode :-("), end="")
130+
print(ensure_str(c or "Could not %scode :-(" % ["en", "de"][args.command == "decode"]), end="")
131131
elif args.command == "guess":
132132
r = codecs.guess(c,
133133
getattr(stopfunc, args.stop_function, args.stop_function),

codext/base/_base2n.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def base2n_encode(string, charset, errors="strict", exc=Base2NEncodeError):
4747
while q % 8 != 0:
4848
q += nb_out
4949
# iterate over the characters, gathering bits to be mapped to the charset
50-
for i, c in enumerate(string):
51-
c = c if isinstance(c, int) else ord(c)
50+
for i, c in enumerate(b(string)):
5251
bs += "{:0>8}".format(bin(c)[2:])
5352
while len(bs) >= nb_out:
5453
r += charset[int(bs[:nb_out], 2)]

0 commit comments

Comments
 (0)