Searching for Colored Highlights Using X-Callback-URL

Hey folks, I’ve been using the x-callback-url feature in Bear to create saved searches. One I use a ton is the ability to search for notes that have highlights, looking for the == syntax.

I have variations that also search for bold + highlighted text (using Tiago Forte’s continuous summarization idea). And I’ve got searches that look for highlights made on documents from the past seven days.

Here are samples:
bear://x-callback-url/search?term=%40last7days%20%3D%3D
bear://x-callback-url/search?term=%3D%3D%2A%2A
bear://x-callback-url/search?term=%3D%3D

With the advent of colored highlights, I want to start using RED for highlights that have prominence over others and build searches for those.

The issue I’m having is that it gets encoded incorrectly when trying to save the following. Maybe Bear isn’t handling emojis properly or doing something funny to it?

I’m trying to create a linked line of text with this:
bear://x-callback-url/search?term=%3D%3D🔴

But when I save the link using the Bear link UI, it always stores as follows:
bear://x-callback-url/search?term=%253D%253D%F0%9F%94%B4

Further details in the reply below.

Key item here is that MANUALLY searching for ==🔴 in Bear returns correct results. The syntax would work if I could get it to be handled correctly in the URL.

Any ideas? And thanks in advance!

I have tried to paste it as straight text and still doesn’t work properly. When clicked, the encoded characters %3D%3D don’t get parsed as == by Bear so long as the emoji is at the end.

Some screenshots of various cases that work and do not work. Not that in the “last 7 days” example, the encoded == characters are treated correctly in the search. But the version with the emoji does not.

Oddly, I use Raycast and when saving the x-callback-url as a quicklink, the same issue happens where %3D%3D aren’t decoded to == when invoked. That said, if I enter the x-callback-url in a browser, it works fine. Hrm.

bear://x-callback-url/search?term=%3D%3D🔴


Hello,

This can’t work because the emoji has to be URL encoded.

I’m not sure what you mean here with Bear link UI, but I suggest using the URL builder for this purpose. The correct encoding should be this one

bear://x-callback-url/search?term=%3D%3D%F0%9F%94%B4

(I’m pretty sure the above is incorrectly re-encoding %)