mklement0 Posted June 19, 2019 Posted June 19, 2019 E.g., searching for "Dunbar's number" correctly shows the preview of the Dictionary.app article, but submitting the entry in order to display it in Dictionary.app quietly fails - a blank page is shown. Omitting the apostrophe (single quote) - searching for "Dunbar number" - works as expected.
Andrew Posted June 20, 2019 Posted June 20, 2019 @mklement0 interesting spot, thanks! It looks like a bug in Dictionary.app as if I type the following into Terminal, I get the same: open "dict://dunbar's number" The best I think I can do to fix this in Alfred is to strip single quotes from the input - I'll do this in the next build Cheers, Andrew mklement0 1
deanishe Posted June 20, 2019 Posted June 20, 2019 23 minutes ago, Andrew said: open "dict://dunbar's number" This works fine, though (on High Sierra): open 'dict://dunbar%27s%20number' Look like you just need to properly encode the URL. mklement0 1
vitor Posted June 20, 2019 Posted June 20, 2019 2 hours ago, deanishe said: This works fine, though (on High Sierra): open 'dict://dunbar%27s%20number' I can confirm it also works on Mojave. But here’s something interesting. In both Alfred and dict://, dunbar's number (straight quote) fails, but dunbar’s number (curly quote) works.
deanishe Posted June 20, 2019 Posted June 20, 2019 Weird. Perhaps some dodgy heuristics in open when figuring out whether/what to URL encode? I've seen it do weird stuff before with URLs that aren't properly escaped. Sometimes they work, sometimes they don't.
Andrew Posted June 20, 2019 Posted June 20, 2019 Alfred uses [NSURL URLWithString:urlString]; and single quote is considered valid in a query so isn't escaped, returning the URL "dict://dunbar's%20number", so this is a bug in Dictionary. Interestingly, Alfred has a custom fallback encoder which encodes lots more (including single quote) if URLWithString fails. If Dictionary is failing to read a fully encoded URL, it makes me nervous to pass a fully encoded string as it may do something opposite.
deanishe Posted June 20, 2019 Posted June 20, 2019 19 minutes ago, Andrew said: If Dictionary is failing to read a fully encoded URL The URL isn't fully encoded, though. Apostrophe is a reserved character, so it should be encoded here. It appears to be a known issue with Apple's URL-encoding routines.
Andrew Posted June 20, 2019 Posted June 20, 2019 3 hours ago, deanishe said: The URL isn't fully encoded I meant fully encoded NSURL... i.e. Apple's own encoding being read by Apple's own Dictionary app.
Andrew Posted June 20, 2019 Posted June 20, 2019 Okie smokie, fiddling around a bit more and I'm going to fix this properly in the next build rather than just removing the single quote
Andrew Posted June 27, 2019 Posted June 27, 2019 This is now fixed in the 4.0.3 b1091 pre-release mklement0 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now