There's a lot of pieces to this, but from what I can tell, they're all necessary to reproduce the problem.
I made a trivial NSURL subclass, like so:
class URL2: NSURL { }
I made a file URL with it:
let f = URL2(fileURLWithPath: "/Users/me/Downloads/ついて.pdf")
Then I tried returning it from previewPanel(panel:previewItemAtIndex index:)
.
Result: I get a generic file icon in the QLPreviewPanel (but it has the correct filename).
Curiously, if I do any of these differently, it works:
- If I use a plain
NSURL(fileURLWithPath: "/Users/me/Downloads/ついて.pdf")
, it displays the file contents correctly. - If I use an ASCII-only filename, it displays the file contents correctly.
- If I do something else with the URL2 (like some NSFileManager operation), it locates the file just fine.
What could I be doing wrong that causes QuickLook to be unhappy with my NSURL subclass in this case?