{"id":31177,"date":"2020-12-31T16:57:25","date_gmt":"2020-12-31T21:57:25","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=31177"},"modified":"2020-12-31T16:57:25","modified_gmt":"2020-12-31T21:57:25","slug":"nsurl-smb-precomposed-character-bug","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2020\/12\/31\/nsurl-smb-precomposed-character-bug\/","title":{"rendered":"NSURL\/SMB Precomposed Character Bug"},"content":{"rendered":"<p><a href=\"http:\/\/www.openradar.me\/radar?id=4984843016339456\">Thomas Tempelmann<\/a> (<a href=\"https:\/\/twitter.com\/tempelorg\/status\/1344408157263683585\">tweet<\/a>):<\/p>\n<blockquote cite=\"http:\/\/www.openradar.me\/radar?id=4984843016339456\"><p>So, if a user on a Linux system creates a folder that contains an Umlaut such as &ldquo;&uuml;&rdquo;, it&rsquo;ll end up precomposed on the (ext4) file system.<\/p><p>Now, I can nicely access files in such a folder from macOS, as long as I only use POSIX functions (which includes the shells such as bash and zsh).<\/p><p>However, when I use <code>NSURL<\/code> operations, some work and others give me a -260 error. For instance, getting <code>NSURLCanonicalPathKey<\/code> fails, even in macOS 11.1. Other higher-level functions fail as well, such as trying to open the item with <code>[NSWorkspace openURLs:&#8230;]<\/code>. The <code>NSURL<\/code>&rsquo;s path property does still hold the original precomposed name, and if I get the path and pass it to a POSIX function, it works. And some of the more basic <code>getResource<\/code> accessors work as well. Just not the more complex ones.<\/p><\/blockquote>\n\n<p>This is not a surprise because, before relenting and adding Unicode normalization support to APFS, Apple tried to solve the problem in the Cocoa layer. But that only ended up being a partial solution, the result being that some APIs never worked properly until file system support was added. Now it seems that same code is doing unwanted conversions before the paths make it down to the lower level APIs.<\/p>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2017\/06\/27\/apfs-native-normalization\/\">APFS Native Normalization<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2017\/03\/24\/apfss-bag-of-bytes-filenames\/\">APFS&rsquo;s &ldquo;Bag of Bytes&rdquo; Filenames<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2017\/03\/31\/apfs-to-add-case-insensitive-variant-for-mac\/\">APFS to Add Case-Insensitive Variant for Mac<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Thomas Tempelmann (tweet): So, if a user on a Linux system creates a folder that contains an Umlaut such as &ldquo;&uuml;&rdquo;, it&rsquo;ll end up precomposed on the (ext4) file system.Now, I can nicely access files in such a folder from macOS, as long as I only use POSIX functions (which includes the shells such as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2020-12-31T21:57:29Z","apple_news_api_id":"c664a0be-31d2-4945-9272-31419a49a42a","apple_news_api_modified_at":"2020-12-31T21:57:29Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AxmSgvjHSSUWScjFBmkmkKg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[131,69,458,30,1891,71,2029,258],"class_list":["post-31177","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-bug","tag-cocoa","tag-finder","tag-mac","tag-macos-11-0","tag-programming","tag-server-message-block-smb","tag-unicode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=31177"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31177\/revisions"}],"predecessor-version":[{"id":31178,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31177\/revisions\/31178"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=31177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=31177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=31177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}