# Rails encoding problem

**URL:** <https://www.ruby-forum.com/t/rails-encoding-problem/132117>\
**Category:** Rails\
**Created:** [March 17, 2008, 5:36am UTC](https://www.ruby-forum.com/t/rails-encoding-problem/132117 "2008-03-17T05:36:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phoenix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/0ea827/32.png) [@phoenix](https://www.ruby-forum.com/u/phoenix)\
**Post date:** [March 17, 2008, 5:36am UTC](https://www.ruby-forum.com/t/rails-encoding-problem/132117/1 "2008-03-17T05:36:21Z")

</div>

I was trying to send an http request in my controller to get the  
content of the response and display it in a text field in the view,  
but sometimes i got a “redundant UTF-8 sequence” exception. Even if  
the exception was not raised, the chinese characters cannot be  
properly displayed.What should I do?

---

<div class="post-metadata">

**Author:** ![phoenix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/0ea827/32.png) [@phoenix](https://www.ruby-forum.com/u/phoenix)\
**Post date:** [March 17, 2008, 7:33am UTC](https://www.ruby-forum.com/t/rails-encoding-problem/132117/2 "2008-03-17T07:33:00Z")

</div>

On Mon, Mar 17, 2008 at 3:35 PM, phoenix [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I was trying to send an http request in my controller to get the  
> content of the response and display it in a text field in the view,  
> but sometimes i got a “redundant UTF-8 sequence” exception. Even if  
> the exception was not raised, the chinese characters cannot be  
> properly displayed.What should I do?

post your controller code…

Mikel

> **[Mikel Lindsaar](https://lindsaar.net/)**
>
> Internet Home for Mikel Lindsaar

---

<div class="post-metadata">

**Author:** ![phoenix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/0ea827/32.png) [@phoenix](https://www.ruby-forum.com/u/phoenix)\
**Post date:** [March 17, 2008, 8:39am UTC](https://www.ruby-forum.com/t/rails-encoding-problem/132117/3 "2008-03-17T08:39:29Z")

</div>

my action code:  
def get\_content  
@url = params[:url]  
response = Net::HTTP.get\_response(URI.parse(@url))  
@content = response.body  
end
