# Builder templates served as US-ASCII

**URL:** <https://www.ruby-forum.com/t/builder-templates-served-as-us-ascii/49264>\
**Category:** Rails\
**Created:** [December 1, 2005, 10:58pm UTC](https://www.ruby-forum.com/t/builder-templates-served-as-us-ascii/49264 "2005-12-01T22:58:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6de8d8/32.png) [@joost](https://www.ruby-forum.com/u/joost)\
**Post date:** [December 1, 2005, 10:58pm UTC](https://www.ruby-forum.com/t/builder-templates-served-as-us-ascii/49264/1 "2005-12-01T22:58:22Z")

</div>

When I produce an xml output with builder, my webserver’s headers say  
it’s encoded as US-ASCII. Since I have iso-8859-1 characters in there, I  
would like to change it. I use lighttpd as a web server, but I don’t  
think it matters since the Builder templates are produced by rails.

Can anyone help?  
Has anyone ever produced an actual _valid_ rss feed using Builder?  
[http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fgomagazine.nl%2Frss%2Fhome](http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fgomagazine.nl%2Frss%2Fhome)

---

<div class="post-metadata">

**Author:** ![joost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6de8d8/32.png) [@joost](https://www.ruby-forum.com/u/joost)\
**Post date:** [December 1, 2005, 11:32pm UTC](https://www.ruby-forum.com/t/builder-templates-served-as-us-ascii/49264/2 "2005-12-01T23:32:09Z")

</div>

On 12/1/05, joost baaij [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> When I produce an xml output with builder, my webserver’s headers say  
> it’s encoded as US-ASCII. Since I have iso-8859-1 characters in there, I  
> would like to change it. I use lighttpd as a web server, but I don’t  
> think it matters since the Builder templates are produced by rails.
> 
> Can anyone help?  
> Has anyone ever produced an actual _valid_ rss feed using Builder?  
> [http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fgomagazine.nl%2Frss%2Fhome](http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fgomagazine.nl%2Frss%2Fhome)

Yup…

[http://feedvalidator.org/check.cgi?url=http%3A%2F%2Frails.techno-weenie.net%2Fxml%2Frecent.xml](http://feedvalidator.org/check.cgi?url=http%3A%2F%2Frails.techno-weenie.net%2Fxml%2Frecent.xml)

Doh, this is embarassing, but it’s not an encoding error 🙂

Try this in your controller somewhere:

headers[‘Content-Type’] = ‘text/xml; charset=iso-8859-1’

–  
rick  
[http://techno-weenie.net](http://techno-weenie.net)

---

<div class="post-metadata">

**Author:** ![joost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6de8d8/32.png) [@joost](https://www.ruby-forum.com/u/joost)\
**Post date:** [December 2, 2005, 10:36am UTC](https://www.ruby-forum.com/t/builder-templates-served-as-us-ascii/49264/3 "2005-12-02T10:36:33Z")

</div>

> Try this in your controller somewhere:
> 
> headers[‘Content-Type’] = ‘text/xml; charset=iso-8859-1’

Brilliant, thanks!
