Why do Automator workflows fail to replace selected text with their actions’ output in Safari 14 (on macOS 11)? After updating from Safari 13 to Safari 14 (on macOS 10.15.6),
I have noticed that all of my text-filtering Automator workflows
no longer work correctly when invoked from the updated Safari.
For an example of such a workflow, see the screenshot below.
It shows a simple workflow that takes the current text selection,
pipes it through the fmt command, and replaces the original
selection with that command’s output:

I have a few workflows of this construction, i.e., consisting of
a single Run Shell Script action running a command that takes
the text selection on its stdin and outputs the text to replace
the selection with on its stdout. I have been using them without
any issues for quite a long time (at least, for the last two major
releases of macOS).
However, when a workflow like that is run from the newly updated
Safari 14, it fails to replace the text selection with the output
of the workflow. Instead, it simply deletes the selected text.
The issue is clearly specific to Safari 14 only, because the same
workflows still work correctly (i.e., replace the selection with
the command’s output) in all other apps (e.g., TextEdit).
Is this caused by some security-related novelty in Safari 14 that
can be disabled, or is it simply a regression bug that has been
introduced in this update? Are there any known workarounds aside
from simulating copying and pasting for the command output in
Automator workflows?
I am not sure what exactly are you trying to accomplish, but I have an AppleScript code to replace characters and maybe it can be a good way for you to start. This solution works no matter the program because it uses GUI scripting, you just need to select the text and invoke the Service.
As you can see the code is changing all : for /; you can use it to adapt for your needs.
on run {}
    tell application &quot;System Events&quot;
        key code 8 using {command down} -- Cmd+C Copy text to clipboard
        delay 0.1
        set the new_path to (the clipboard as string)
        set save_location to my replace_chars(new_path, &quot;:&quot;, &quot;/&quot;)
        delay 0.1
        set the clipboard to save_location
        key code 9 using {command down} -- Cmd+V Paste clipboard back
    end tell
end run

on replace_chars(this_text, search_string, replacement_string)
    set AppleScript's text item delimiters to the search_string
    set the item_list to every text item of this_text
    set AppleScript's text item delimiters to the replacement_string
    set this_text to the item_list as string
    set AppleScript's text item delimiters to &quot;&quot;
    return this_text
end replace_chars