Handle unicode in pads
This commit is contained in:
parent
f914a48b53
commit
d932006941
@ -348,7 +348,14 @@ async def handle_pad(args, padid, data, info, session):
|
||||
ver["path"] = p + raw_ext
|
||||
ver["url"] = quote(ver["path"])
|
||||
async with await trio.open_file(ver["path"], "w") as f:
|
||||
await f.write(text)
|
||||
try:
|
||||
# Note(decentral1se): unicode handling...
|
||||
safe_text = text.encode("utf-8", "replace").decode()
|
||||
await f.write(safe_text)
|
||||
except Exception as exception:
|
||||
print(path)
|
||||
print("PANIC: {}".format(exception))
|
||||
|
||||
# once the content is settled, compute a hash
|
||||
# and link it in the metadata!
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user