# RJS template eating encoding

**URL:** <https://www.ruby-forum.com/t/rjs-template-eating-encoding/54940>\
**Category:** Rails\
**Created:** [March 15, 2006, 12:23pm UTC](https://www.ruby-forum.com/t/rjs-template-eating-encoding/54940 "2006-03-15T12:23:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_McCafferty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/73ab20/32.png) [@Patrick\_McCafferty](https://www.ruby-forum.com/u/Patrick_McCafferty)\
**Post date:** [March 15, 2006, 12:23pm UTC](https://www.ruby-forum.com/t/rjs-template-eating-encoding/54940/1 "2006-03-15T12:23:57Z")

</div>

I was previously doing an update via .rhtml templates creating an AJAX  
:evaluate\_remote\_response. I use UTF-8 in my pages, and my app  
requires that I be able to, say, put Japanese characters in.

The problem is that when I switched this over to an RJS template it  
started eating the encoding. I now get garbage characters where before  
I got the correct ones.

The code for the RHTML:

\<%= update\_element\_function(  
“front”, :content =\> simple\_format( h(@card.front\_side))) %\>  
\<%= update\_element\_function(  
“back”, :content =\> simple\_format( h(@card.back\_side))) %\>

and for RJS:

page.replace\_html ‘front’, simple\_format( h( @card.front\_side ) )  
page.replace\_html ‘back’, simple\_format( h( @card.back\_side ) )

If I go to the action manually and check, in the RHTML version it has  
the correct characters; in the RJS version it has the \312\342 escape  
codes.

Any way to turn off the escaping?

---

<div class="post-metadata">

**Author:** ![Patrick\_McCafferty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/73ab20/32.png) [@Patrick\_McCafferty](https://www.ruby-forum.com/u/Patrick_McCafferty)\
**Post date:** [March 15, 2006, 8:44pm UTC](https://www.ruby-forum.com/t/rjs-template-eating-encoding/54940/2 "2006-03-15T20:44:01Z")

</div>

Hi,

I want to launch a rails application from a regular .html page. It  
works just fine with apache on my web host provider’s server but I  
can’t seem to figure out how to get the index.html to show up while  
I’m running lighttpd and using [http://localhost:3000/welcome.html/](http://localhost:3000/welcome.html/)

Seems like a dumb question, but any help would be appreciated.

Denise

---

<div class="post-metadata">

**Author:** ![Patrick\_McCafferty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/73ab20/32.png) [@Patrick\_McCafferty](https://www.ruby-forum.com/u/Patrick_McCafferty)\
**Post date:** [March 15, 2006, 9:40pm UTC](https://www.ruby-forum.com/t/rjs-template-eating-encoding/54940/3 "2006-03-15T21:40:09Z")

</div>

[http://localhost:3000/welcome.html/](http://localhost:3000/welcome.html/) points to a directory called  
welcome.html/

I guess I am unclear on what you mean by “Launch a rails application  
from a regular .html page”

~ Ben

On 3/15/06, Denise E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Ben R.  
[http://www.benr75.com](http://www.benr75.com)

---

<div class="post-metadata">

**Author:** ![Patrick\_McCafferty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/73ab20/32.png) [@Patrick\_McCafferty](https://www.ruby-forum.com/u/Patrick_McCafferty)\
**Post date:** [March 15, 2006, 11:51pm UTC](https://www.ruby-forum.com/t/rjs-template-eating-encoding/54940/4 "2006-03-15T23:51:52Z")

</div>

Hi,

What is mean is my ordinary everyday .html file has a form with a  
submit button and on the submit button is the url for a rails  
controller. If the user clicks the button, the rails controller  
evaluates values from the post and redirects him/her to the right  
page within the app. If the user never clicks the button, the rails  
app is never launched. Is that more clear?

Thanks,  
Denise
