# Unicode question - will it work?

**URL:** <https://www.ruby-forum.com/t/unicode-question-will-it-work/171932>\
**Category:** Rails\
**Created:** [July 11, 2009, 6:21pm UTC](https://www.ruby-forum.com/t/unicode-question-will-it-work/171932 "2009-07-11T18:21:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bjoern](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/46a35a/32.png) [@Bjoern](https://www.ruby-forum.com/u/Bjoern)\
**Post date:** [July 11, 2009, 6:21pm UTC](https://www.ruby-forum.com/t/unicode-question-will-it-work/171932/1 "2009-07-11T18:21:23Z")

</div>

Hi,

my apologies for that very basic question. I have heard from many  
people that unicode worked well for them, but I have been unable to  
find any definite information on how it works (with Rails). I gather  
that as long as I don’t do anything but pass the Strings along, it  
will probably work (that’s what people said anyway). And there is  
ActiveSupport::Multibyte

But what about external libraries? For example I want to access some  
web services and parse JSON data. Will the JSON parser work correctly  
if there are unicode Strings in the result? What about other  
libraries? Or maybe in general I just need to call the mb\_chars method  
on Strings and pass the result to libraries instead of the original  
Strings?

Would be glad for any pointers!

I would prefer to use Ruby 1.9.1 to avoid the issue completely, but I  
still have problems getting proper documentation for the STDLIB.

Björn

---

<div class="post-metadata">

**Author:** ![Bjoern](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/46a35a/32.png) [@Bjoern](https://www.ruby-forum.com/u/Bjoern)\
**Post date:** [July 12, 2009, 5:20pm UTC](https://www.ruby-forum.com/t/unicode-question-will-it-work/171932/2 "2009-07-12T17:20:07Z")

</div>

Bjoern wrote:

> Hi,
> 
> my apologies for that very basic question. I have heard from many  
> people that unicode worked well for them, but I have been unable to  
> find any definite information on how it works (with Rails).

Make sure the DB encoding and the appropriate header in the generated  
HTML are both set to UTF-8 (or UTF-16, I suppose, but I’ve never tried  
that).

> I gather  
> that as long as I don’t do anything but pass the Strings along, it  
> will probably work (that’s what people said anyway).

Yes.

> And there is  
> ActiveSupport::Multibyte
> 
> But what about external libraries? For example I want to access some  
> web services and parse JSON data. Will the JSON parser work correctly  
> if there are unicode Strings in the result?

I don’t see why not, but you could always test and see.

[…]

> I would prefer to use Ruby 1.9.1 to avoid the issue completely, but I  
> still have problems getting proper documentation for the STDLIB.

Try [http://www.ruby-doc.org](http://www.ruby-doc.org) .

Ruby 1.9 is still problematic in terms of compatibility – I understand  
that Rails works well with it, but many gems and plugins do not.

> Bjï¿½rn

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
