Forum: Ruby on Rails Charset problems with partials

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Martin S. (Guest)
on 2007-06-22 18:27
(Received via mailing list)

When using partials, I'm not able to keep the text posted as
ISO-8859-1, it changes to UTF-8.
The browser detects the page as ISO-8859-1, but I know the string from
the form is not
ISO-8859-1 when given to the method.

I'm able to keep the string as ISO-8859-1 if I don't use any partials or

This is how the view with partials and RJS looks like:

    <html xmlns="" xml:lang="en" lang="en">
      <meta http-equiv="content-type"
content="text/html;charset=ISO-8859-1" />
      <title>Send it: <%= controller.action_name %></title>
      <%= stylesheet_link_tag 'nb' %>

    <%= render :partial => "publish" %>

        <meta http-equiv="Content-type" content="text/html;
charset=ISO-8859-1" />

    <%= form_remote_tag :url => { :action => 'publish' },
      :before => "'spinner');",
      :success => "show_results(xhr);",
      :failure => "show_error(xhr);",
      :complete => "Element.hide('spinner');",
      :html => { :id => 'thought-form' } %>

    <%= text_area 'message', 'text', :maxlength => 60 %>

     <%= submit_tag 'Publish' %>
     <%= end_form_tag %>

    <div id="thoughts">

    page.replace_html 'thoughts', :partial => 'status'
    page.visual_effect :highlight, 'thoughts'
    page.form.reset 'thought-form'

      <p style="color: green"><%= flash[:notice] %></p>
      <p style="color: red"><%= flash[:warning] %></p>

The code abow changes the input string to UTF-8, but the below does not.
How do I make sure the string is ISO-8859-1 through all of the

    <html xmlns="">
        <meta http-equiv="Content-type" content="text/html;
charset=ISO-8859-1" />

    <%= form_tag :action => 'plainpublish' %>

    <%= text_area 'message', 'text', :maxlength => 60 %>
    <%= submit_tag 'Publish' %>
    <%= end_form_tag %>

The methods are identical except for the name.

Any thoughts or suggestions are highly appreciated! :)

Martin S.
Nicolas E. (Guest)
on 2008-06-13 18:09
I have exactly the same problem, Martin.

Did you find out a way to solve this?

This topic is locked and can not be replied to.