and found that {popclip text} is not URL-encoded. As a result, when user select some text starting with #, text is empty, because # is seen as a separator.
Intially I used Open URL action, but switched to AppleScript because it can open the app even if it’s not launched.
Is there a way to write the extension to achieve both (encoding URL, launch app)?
{popclip text} is only automatically URL-encoded in an Open URL action . In an AppleScript action, as it’s just the raw string. For the encoded version you can use {popclip urlencoded text} as per Script variables.