How to get Automator to treat text as RTF?
I usually use scripts like this instead of Automator services:

try
    set old to the clipboard as record
end try
tell application "System Events" to keystroke "c" using command down
do shell script "export LC_CTYPE=UTF-8; pbpaste | /usr/local/bin/pygmentize -g -f rtf | pbcopy"
tell application "System Events" to keystroke "v" using command down
delay 0.05
try
    set the clipboard to old
end try



If the clipboard is empty, trying to get it results in an error.
pbpaste and pbcopy use ASCII if the locale variables are unset. I couldn't get pygmentize -f rtf to work with non-ASCII characters though.
Without the delay set the clipboard to old would sometimes be run before the text would get pasted.