# \[Mongrel\] I want to change the default encoding to utf-8

**URL:** <https://www.ruby-forum.com/t/mongrel-i-want-to-change-the-default-encoding-to-utf-8/95473>\
**Category:** Ruby\
**Created:** [June 2, 2006, 6:07pm UTC](https://www.ruby-forum.com/t/mongrel-i-want-to-change-the-default-encoding-to-utf-8/95473 "2006-06-02T18:07:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [June 2, 2006, 6:07pm UTC](https://www.ruby-forum.com/t/mongrel-i-want-to-change-the-default-encoding-to-utf-8/95473/1 "2006-06-02T18:07:33Z")

</div>

Hello,

I’m using mongrel\_rails 0.3.12.4 to start a radiantcms site  
([http://radiantcms.org/](http://radiantcms.org/)) and all the pages/snippets/layouts I’m using  
are in utf-8. By default, mongrel sends “text/html” as content-type w/o  
any indication of charset and browsers thus assume iso-8859-1 (as they  
should).

I’ve tried to follow the HOWTO at  
[http://mongrel.rubyforge.org/docs/howto.html](http://mongrel.rubyforge.org/docs/howto.html) but adding a mime.yml with

* * *

.html: text/html; charset=utf-8

doesn’t seem to work.

Any idea?

Thanks.

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [June 3, 2006, 6:26am UTC](https://www.ruby-forum.com/t/mongrel-i-want-to-change-the-default-encoding-to-utf-8/95473/2 "2006-06-03T06:26:18Z")

</div>

Ollivier R. wrote:

> * * *
> 
> .html: text/html; charset=utf-8
> 
> doesn’t seem to work.
> 
> Any idea?

Have you tried setting the content type on the layout?

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [June 3, 2006, 3:42pm UTC](https://www.ruby-forum.com/t/mongrel-i-want-to-change-the-default-encoding-to-utf-8/95473/3 "2006-06-03T15:42:28Z")

</div>

On Jun 2, 2006, at 2:39 PM, Ollivier R. wrote:

> [http://mongrel.rubyforge.org/docs/howto.html](http://mongrel.rubyforge.org/docs/howto.html) but adding a mime.yml  
> with
> 
> * * *
> 
> .html: text/html; charset=utf-8
> 
> doesn’t seem to work.
> 
> Any idea?

Does it work with Webrick? If it is working with Webrick but not with  
Mongrel then try adding:

to your page header. For reasons I haven’t bothered thinking about  
this worked for me. Maybe it is more widely useful? Don’t know (I  
find thinking about character encoding gives me a really bad  
headache…)

Cheers,  
Bob

> Thanks.
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

* * *

Bob H. – blogs at \<[http://www.recursive.ca/](http://www.recursive.ca/)  
hutch/\>  
Recursive Design Inc. – [http://www.recursive.ca/](http://www.recursive.ca/)  
Raconteur – [http://www.raconteur.info/](http://www.raconteur.info/)  
xampl for Ruby – [http://rubyforge.org/projects/xampl/](http://rubyforge.org/projects/xampl/)

---

<div class="post-metadata">

**Author:** ![keltia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/da6949/32.png) [@keltia](https://www.ruby-forum.com/u/keltia)\
**Post date:** [June 3, 2006, 11:02pm UTC](https://www.ruby-forum.com/t/mongrel-i-want-to-change-the-default-encoding-to-utf-8/95473/4 "2006-06-03T23:02:54Z")

</div>

On Sat, 2006-06-03 at 03:39 +0900, Ollivier R. wrote:

> * * *
> 
> .html: text/html; charset=utf-8

Actually, Ollivier, there’s a bug in 0.3.12.4 where the mime types  
aren’t picked up. If you can, use the pre-release which fixes this and  
many other problems:

gem install mongrel --source=http://mongrel.rubyforge.org/releases/

Then let me know if it’s still broken.
