# How to set Browser Encoding?

**URL:** <https://www.ruby-forum.com/t/how-to-set-browser-encoding/108154>\
**Category:** Ruby\
**Created:** [June 29, 2007, 2:29pm UTC](https://www.ruby-forum.com/t/how-to-set-browser-encoding/108154 "2007-06-29T14:29:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chirag](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@chirag](https://www.ruby-forum.com/u/chirag)\
**Post date:** [June 29, 2007, 2:29pm UTC](https://www.ruby-forum.com/t/how-to-set-browser-encoding/108154/1 "2007-06-29T14:29:16Z")

</div>

i want to set browser encoding through ruby code.  
i want it to be western-European(windows).

my web page showing question mark for some html content . so i want to  
do this setting. if i change it explicitly from encoding then its  
working perfect.  
i want it to do through code.

---

<div class="post-metadata">

**Author:** ![chirag](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@chirag](https://www.ruby-forum.com/u/chirag)\
**Post date:** [June 30, 2007, 1:08am UTC](https://www.ruby-forum.com/t/how-to-set-browser-encoding/108154/2 "2007-06-30T01:08:13Z")

</div>

Chirag P. wrote:

> i want to set browser encoding through ruby code.  
> i want it to be western-European(windows).
> 
> my web page showing question mark for some html content . so i want to  
> do this setting. if i change it explicitly from encoding then its  
> working perfect.  
> i want it to do through code.

You can’t really set it. You can tell the browser what it is through the  
Content-Type header, e.g. "Content-Type: text/html; charset=utf-8 (that  
is an HTTP header and not in the HTML code).  
For standalone viewing (i.e. if the user saved the HTML to disk and  
opens it from there, so no server is providing any header) there is the

 tag in the header. Now how you set http headers or output html is completly depending on your framework. Consult your documentation.

Regards  
Stefan
