Forum: Ruby on Rails How to change the response charset

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
xabriel (Guest)
on 2009-04-08 08:46
(Received via mailing list)
Hi all,

I have the following on a controller method:

  render :text => "A string message"

I want that response body to be converted to US-ASCII. (BTW, Ruby
seems to default to UTF-8)

Any ideas? I know theres a 'response.charset', but that seems to only
change the response's charset header. I need the actual body string to
be changed to US-ASCII.
xabriel (Guest)
on 2009-04-08 21:23
(Received via mailing list)
Well, I fixed this issue following Charset conversion rules from this
blog post:
http://blog.grayproductions.net/articles/encoding_...

James (the blog author) actually has the most comprehensive treatment
on Ruby Strings (both for 1.8 & 1.9).

Hope this helps somebody someday! :)
xabriel (Guest)
on 2009-04-08 21:24
(Received via mailing list)
Well, I fixed this issue following Charset conversion rules from this
blog post:
http://blog.grayproductions.net/articles/encoding_...

James (the blog author) actually has the most comprehensive treatment
on Ruby Strings (both for 1.8 & 1.9).

Hope this helps somebody someday! :)
This topic is locked and can not be replied to.