Ruby on rails x charset
I have a problem handling charset in ruby on rails app, especially in my templates. The code that comes from my database works great, but codes like ç ~ that are in my views don't work. I have added the following codes to my code
I added a feature like this, but it still doesn't work. I have ç ~ codes in my application.rhtml not working.
before_filter :configure_charsets
# Configuring charset to UTF-8 def configure_charsets
headers["Content-Type"] = "text/html; charset=UTF-8"
end
I added also meta http-equiv html to utf-8 and .htaccess parameter AddDefaultCharset UTF-8
What else doesn't work, any other advice?
a source to share
Is a text editor used to place special characters in the file (source or presentation) that treats those characters as UTF-8? For example, if you are using TextMate, you can intentionally save the file as UTF-8. If for some reason you've used a different encoding before (the default, perhaps), these UTF-8 characters can be recoded during the code editing phase, so even if the rendering process uses UTF-8 all over the place, it still won't work.
Also, if you are using something from the shell like vi or whatever, is your terminal configured to accept UTF-8 by default? If you installed ISO-8859-1 or whatever, you get the same problem.
a source to share
So, if the content of your file is UTF-8 and the output is interpreted as UTF-8, then data change occurs between them. Can give us a sixth interpretation of the input bytes (something non-ASCII would be at least two bytes in UTF-8) for one of your special characters, and a hexadecimal interpretation of the output byte or bytes? Perhaps we can figure out what the change is and work out from there.
a source to share