Based on my regular use of @Bernardo_V’s really useful script, I found a couple additional special characters that cause trouble. Most special characters don’t have an impact but some do, specifically apostrophe, ampersand and forward slash. If the linked paragraph contains these characters, the link doesn’t work.
I have since adapted the script to take this into account by replacing these characters with the respective HTML codes in the generated link, such that it now does find and highlight the selected paragraph even if these special characters are present.
Here’s the slightly modified version - all credit to Bernardo for coming up with the script.
tell application id "DNtp"
set theRecord to (content record of think window 1)
set theSelection to the selected text of think window 1 as string
set theSelection to my replaceText(theSelection, " ", "%20")
set theSelection to my replaceText(theSelection, ";", "%3B")
set theSelection to my replaceText(theSelection, "&", "%26")
set theSelection to my replaceText(theSelection, "/", "%2F")
set theURL to get the reference URL of theRecord & "?search=" & theSelection
set the clipboard to theURL
end tell
on replaceText(theString, old, new)
set {TID, text item delimiters} to {text item delimiters, old}
set theStringItems to text items of theString
set text item delimiters to new
set theString to theStringItems as text
set text item delimiters to TID
return theString
end replaceText