# Rails bug with partials and charsets?

**URL:** <https://www.ruby-forum.com/t/rails-bug-with-partials-and-charsets/107703>\
**Category:** Rails\
**Created:** [June 25, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/rails-bug-with-partials-and-charsets/107703 "2007-06-25T16:02:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![msojka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b5a626/32.png) [@msojka](https://www.ruby-forum.com/u/msojka)\
**Post date:** [June 25, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/rails-bug-with-partials-and-charsets/107703/1 "2007-06-25T16:02:14Z")

</div>

Hi,

Is there a bug with the use of partials and how the input from forms is  
handled?

My app is working fine if I use a plain view and form\_tag, but as  
soon as I switch to partials and form\_remote\_tag I’m not able to  
keep the input as ISO-8859-1

I’d like to use form\_remote\_tag, or at least find a way to keep the  
spinner and Ajax effects.

The code is available at [Parked at Loopia](http://pastie.caboo.se/73275)  
I’m running Ruby 1.8.5 and Rails 1.2.3.

Any hints to what I might do wrong, or what topics I should dig into, is  
highly appreciated!

Cheers,  
Martin S.

---

<div class="post-metadata">

**Author:** ![msojka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b5a626/32.png) [@msojka](https://www.ruby-forum.com/u/msojka)\
**Post date:** [June 26, 2007, 3:10am UTC](https://www.ruby-forum.com/t/rails-bug-with-partials-and-charsets/107703/2 "2007-06-26T03:10:07Z")

</div>

Well, for starters, you’ve got and tags in your  
partial. That’s got to be confusing your browser. Rip the first 4  
lines out of your partial and try again.

My next suggestion is to try to move your \_publish partial into  
main.rhtml. I suspect the problem you’re having has nothing to do  
with using partials, and more to do with how rails, or your browser,  
processes AJAX requests. (Assuming that the two wasn’t the  
problem, which it might be.)

On Jun 25, 8:01 am, “Martin S.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![msojka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b5a626/32.png) [@msojka](https://www.ruby-forum.com/u/msojka)\
**Post date:** [July 28, 2007, 5:47pm UTC](https://www.ruby-forum.com/t/rails-bug-with-partials-and-charsets/107703/3 "2007-07-28T17:47:28Z")

</div>

Hi,

> On Jun 25, 8:01 am, “Martin S.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> 
> > Is there a bug with the use of partials and how the input from forms is  
> > handled?
> > 
> > My app is working fine if I use a plain view and form\_tag, but as  
> > soon as I switch to partials and form\_remote\_tag I’m not able to  
> > keep the input as ISO-8859-1

On 25/06/07, Jon [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Well, for starters, you’ve got and tags in your  
> partial. That’s got to be confusing your browser. Rip the first 4  
> lines out of your partial and try again.  
> My next suggestion is to try to move your \_publish partial into  
> main.rhtml. I suspect the problem you’re having has nothing to do  
> with using partials, and more to do with how rails, or your browser,  
> processes AJAX requests. (Assuming that the two wasn’t the  
> problem, which it might be.)

Thanks for the tips Jon, I tried that but wasn´t able to keep the  
charset even after I made the changes you suggested.  
The only part that really needed ISO-8859-1 was CGI.escape, so I  
converted the string with iconv just before I passed it along to  
CGI.escape.

iso\_str = Iconv.new(‘iso-8859-1’, ‘utf-8’).iconv(message)  
encoded\_message = CGI.escape(iso\_str)

Cheers,  
Martin
