dealing with special characters

1 view
Skip to first unread message

J. mp

unread,
Feb 10, 2007, 2:35:06 PM2/10/07
to rubyonra...@googlegroups.com
hi all,

what is the best way to deal with non-english characters?

for example, I have a field withthe value "joão" after saving the value
"João". How do I deal with this issue?

Thnaks

--
Posted via http://www.ruby-forum.com/.

Guest

unread,
Feb 10, 2007, 4:54:11 PM2/10/07
to rubyonra...@googlegroups.com
I'm not an expert, but I have also had some difficulties with this
before. The key things to resolve this for me were:

1. make sure that your database field formats are correct (e.g. utf-8).
2. add (depending on your database field formats) something like: <meta
http-equiv="content-type" content="text/html; charset=utf-8" /> to your
layout.

Hope this helps

Darren


Hope this helps

J. mp

unread,
Feb 10, 2007, 5:00:57 PM2/10/07
to rubyonra...@googlegroups.com

Thansk,
I've done that already. Thanks
now my probkem is other :)
in my db i'm saving correclty the string, but I'm now seeking for a way
to replace all charecters like ã, Â, â, Â, etc by their corresponding
HTML codes, and I can't find a way to do that

Rob Biedenharn

unread,
Feb 10, 2007, 5:12:39 PM2/10/07
to rubyonra...@googlegroups.com

There's no general way to do that since HTML doesn't define character
entities for all possible characters. If you've specified that utf-8
is in use throughout (database, Rails [Ruby's $KCODE], HTML), then
you shouldn't need to convert. Of course, the end user may not be
able to see the character you intend if his/her system lacks a
suitable font.

-Rob

Rob Biedenharn http://agileconsultingllc.com
R...@AgileConsultingLLC.com


Reply all
Reply to author
Forward
0 new messages