how to render special characters properly in ruby on rails? -


i characters ’ … – “ †‘ db. table fetching in latin1 character set. need show these characters properly. how in ruby on rails? there function or piece of code replace these characters correct ones?

you need set encoding of db string. try encode method of string:

dbstr.encode("iso-8859-1") 

there plenty of other encodings if iso 8859 1 doesn't work you. if users browser doesn't support right encoding, there options can pass encode replace unknowns ?s, etc.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -