Created
March 25, 2017 08:10
-
-
Save norio-nomura/c8a4addd659e1208df500a37da58536d to your computer and use it in GitHub Desktop.
APFSでファイル名がUnicode正規化されないことを検証する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let filenames = [ | |
"\u{30D1}\u{30D1}", // パパ | |
"\u{30CF}\u{309A}\u{30CF}\u{309A}", // パパ | |
] | |
let fm = FileManager.default | |
let baseURL = fm.urls(for: .documentDirectory, in: .userDomainMask)[0] | |
filenames.forEach { filename in | |
let url = baseURL.appendingPathComponent(filename) | |
let fd = fopen(url.path, "w") | |
fputs(url.path, fd) | |
fclose(fd) | |
} | |
let files = try! fm.contentsOfDirectory(atPath: baseURL.path) | |
let filenameAndEscaped = files.map { | |
($0, | |
$0.unicodeScalars.map({ | |
"\\{\(String($0.value, radix: 16))}" | |
}).joined()) | |
} | |
filenameAndEscaped.forEach { print($0) } | |
/* | |
iOS 10.3実機だと | |
("パパ", "\\{30cf}\\{309a}\\{30cf}\\{309a}") | |
("パパ", "\\{30d1}\\{30d1}") | |
iOS 10.3 Simulatorだと | |
("パパ", "\\{30cf}\\{309a}\\{30cf}\\{309a}") | |
になる | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
i'm affected too with your bug https://openradar.appspot.com/31265273
Is there any way (prefered without XCode) to check which app or which app's file-store contain the files, so that i can backup again?