We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bae9d2d commit adb71bdCopy full SHA for adb71bd
slack_parse.py
@@ -19,6 +19,7 @@
19
import json
20
import re
21
import sys
22
+import unicodedata
23
24
# Import the user id <-> nick dict
25
users = {}
@@ -82,9 +83,11 @@ def parse_line(line):
82
83
84
def replace_with_special(text):
85
"Substitutes user ids with nicks, channel ids with channels, escaped chars"
86
+ unicode_pass = \
87
+ unicodedata.normalize("NFKD", text).encode("ascii", "ignore")
88
users_pass = re.sub(r"<@(U[0-9A-Z]{8})(\|[^>]*)?>",
89
lambda x: users[x.group(1)],
- text)
90
+ unicode_pass)
91
channels_pass = re.sub(r"<#(C[0-9A-Z]{8})>",
92
lambda x: channels[x.group(1)],
93
users_pass)
0 commit comments