Skip to content

Commit

Permalink
one more character encoding trick
Browse files Browse the repository at this point in the history
  • Loading branch information
aborel committed Oct 19, 2022
1 parent a40b474 commit 0ec2cae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path
from tkinter import filedialog, messagebox
from tkinter import Tk, Button
from unicodedata import normalize

version = "0.5"

Expand Down Expand Up @@ -47,7 +48,8 @@ def runchecksum():
for element in files:
md5 = md5Checksum(element)
# filenames must be encoded as UTF-8, or they might not match what Libsafe sees on the filesystem
f.write(f'{md5} {element.replace(choosedir,".")}\n'.encode("UTF-8"))
# also: NFC normalization for proper (composed) representation of accented characters
f.write(normalize('NFC',f'{md5} {element.replace(choosedir,".")}\n').encode("UTF-8"))

f.close()
messagebox.showinfo(title="Done", message="ACOUA_md5.md5 created")
Expand Down

0 comments on commit 0ec2cae

Please sign in to comment.