Skip to content

Commit 6c09fb2

Browse files
eleanordoesntcodedavide125
authored andcommitted
discard/replace characters not part of the ASCII set for FAT partitions
Signed-off-by: éléanore is not coding in the slightest <[email protected]>
1 parent ba24e80 commit 6c09fb2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/osinstall.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import m1n1
55
from util import *
6+
import unicodedata
67

78
class OSInstaller(PackageInstaller):
89
PART_ALIGNMENT = 1024 * 1024
@@ -94,6 +95,7 @@ def partition_disk(self, prev, total_size=None):
9495
if fmt == "fat":
9596
# Clean up invalid characters in FAT
9697
name_clean = name.translate(str.maketrans("", "", "*?/\\|,;:+=<>[]\""))
98+
name_clean = unicodedata.normalize('NFKD', name_clean).encode('ascii', 'ignore').decode('ascii')
9799
p_plain(" Formatting as FAT...")
98100
args = ["newfs_msdos", "-F", "32",
99101
"-v", name_clean[:11]]

0 commit comments

Comments
 (0)