I get characters like ’ … – “ †‘ from DB. The table from which i am fetching is in latin1 character set. I need to show these characters properly. How to do this in Ruby on rails? Is there a function or piece of code which will replace these characters with correct ones?
Share
You probably need to set the encoding of the DB string. Try the
encodemethod ofString:There are plenty of other encodings if ISO 8859 1 doesn’t work for you. If the users browser doesn’t support the right encoding, there are options you can pass to
encodeto get it to replace unknowns with?s, etc.