Jump to content

Dictionary > Define a word functionality fails to open the relevant page in Dictionary.app when the search term includes an apostrophe [Fixed 4.0.3 b1091 pre-release]


Recommended Posts

Posted

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.

 

Posted

@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

Posted
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.

Posted
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.

Posted

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.

 

Posted

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.

Posted
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.

Posted
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.

Posted

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 changed the title to Dictionary > Define a word functionality fails to open the relevant page in Dictionary.app when the search term includes an apostrophe [Fixed 4.0.3 b1091 pre-release]

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...