I'll have something like this to output the text to the browser:
send_data(@output, :type => 'text/plain', :disposition => 'inline')
But if the text is UTF-8 and contains non-ASCII characters then you need to specify the character set.
Confusingly, to me, you don't do this with a separate argument at the Rails level. Instead you add it as a modifier on the :type argument like this:
send_data(@output, :type => 'text/plain; charset=utf-8', :disposition => 'inline')