ok,... thanks for the info. I guess I am missing the meta-charset in the ajax view. its kind of a weird place to put it but I'll try anyway.

On 11/12/06, Manfred Stienstra <[EMAIL PROTECTED]> wrote:

On Nov 12, 2006, at 12:37 PM, Mathieu Jobin wrote:
>
> I just encountered my first MultiByte problem with Rails <= 1.1
> I guess I have been lucky.
> I am just wondering if ActiveSupport::MultiByte fix this specific
> case.

I'm inclined to say no. Multibyte doesn't magically solve any
problems you might have with multibyte encoded strings. It solves
problems with encoded strings in most Rails methods that handle
string somehow, like view helpers.

> render_text _("Rename selected %s to `%s' now.") % [params
> [:item_type], params['name']]
>
> the two params['xx'] contains Japanese strings. and are displayed as
>
> %u65D7%u9F13

Have you checked what the actual encoding of the strings is before
you assign to the string? One good test to is too check if they're
utf-8 by calling String#is_utf8?.

> but since I never had this problem before, I doubt the problem is
> actually the % operator. while it may be. I think it is important
> to note this is happening through Ajax. which might be causing the
> problem as well.

Most data processing pipelines still aren't utf-8 by default. You
have to make sure that everything is doing the utf-8 dance. So make
sure the page where the request is coming from was served
with ;charset=utf-8 in the content-type. You might even want to
specify the content-type with a meta tag.

   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

If you're getting Ajax request from a page beyond your control, you
might be out of luck because it's hard to find out what encoding your
getting the string in. If you know what encoding they're sending you
can fix the encoding with iconv.

> Would this work under rails 1.2 with ActiveSupport::MultiByte and
> is it possible to install ActiveSupport::MultiByte on rails 1.1.6 ?

If it doesn't work in the rails-1.2 pre-release branch, it's probably
not going to change for the release unless it's a major bug. It is
very possible to install ActiveSupport::Multibyte in older versions
of Rails. You only get the ActiveSupport::Multibyte namespace with
all the operations, not all the code fixes currently in edge. You can
find more information about this on: https://fngtps.com/projects/
multibyte_for_rails/wiki/WikiStart







--
gcc -O0  -DRUBY_EXPORT   -rdynamic -Wl,-export-dynamic -L.   main.o  -lruby-static -ldl -lcrypt -lm   -o ruby
Everyone is trying their hardest to do their job but management has set it up so that it's impossible.
Take the control over your money, track your expenses http://justbudget.com

Mathieu
--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to