I just created a test bang "!testbang" with the default redirect as "https://kagi.com/search?q=%s".
If I do this search: "!testbang c#" it strips the "#" character and only searches for "c" (which you can guess it's the wrong search if we're talking the programming language, or the musical note). Also tried it with "https://duckduckgo.com/?q=%s", with the same problem.
It seems to do the same thing whether I'm searching using my Firefox address bar, and with the search box in the kagi.com website.
If I search "c#" it should redirect with the same query, unchanged.
I'm not totally knowledgeable about escaping text for URL GET parameters, but it should be doable, and the current result is not correct.