Unicode question - will it work?

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

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 .

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
[email protected]