tnk2908 commited on
Commit
568d4c9
1 Parent(s): 046a023

Ignore readable messages that contains non-ASCII

Browse files
Files changed (1) hide show
  1. analyse.py +6 -2
analyse.py CHANGED
@@ -41,9 +41,13 @@ def load_msgs(msg_lens: list[int], file: str | None = None):
41
  )
42
  msgs["random"].append(base64_msg)
43
 
44
- readable_msg = next(iterator)["text"]
45
- while len(readable_msg) < length:
46
  readable_msg = next(iterator)["text"]
 
 
 
 
 
47
  msgs["readable"].append(readable_msg[:length])
48
 
49
  return msgs
 
41
  )
42
  msgs["random"].append(base64_msg)
43
 
44
+ while True:
 
45
  readable_msg = next(iterator)["text"]
46
+ try :
47
+ readable_msg[:length].encode("ascii")
48
+ break
49
+ except Exception as e:
50
+ continue
51
  msgs["readable"].append(readable_msg[:length])
52
 
53
  return msgs