Hi, i have a database with data that contains special html chars ... for example, i may have names like "damián" "guzmán" and they get displayed like "dami?n" and "guzm?n" in the browser, i need a render function that allow me to convert those names to the html version ("damián" and "guzmán") before display them ... any ideas will be most welcome ... thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/19/07, Damian Rr <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, i have a database with data that contains special html chars ... for > example, i may have names like "damián" "guzmán" and they get displayed > like "dami?n" and "guzm?n" in the browser, i need a render function that > allow me to convert those names to the html version ("damián" and > "guzmán") before display them ... any ideas will be most welcome > ... thanksWhy not just declare your output encoding to match the encoding of the data in your database? Or better yet, convert the data in the database to UTF-8, which all modern browsers support and which Rails sets as default output encoding. HTML entities are handy for use in literals in your source code, but aren''t really appropriate for your data in this case. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bob Showalter wrote:> On 6/19/07, Damian Rr <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> Hi, i have a database with data that contains special html chars ... for >> example, i may have names like "dami�n" "guzm�n" and they get displayed >> like "dami?n" and "guzm?n" in the browser, i need a render function that >> allow me to convert those names to the html version ("damián" and >> "guzmán") before display them ... any ideas will be most welcome >> ... thanks > > Why not just declare your output encoding to match the encoding of the > data in your database? Or better yet, convert the data in the database > to UTF-8, which all modern browsers support and which Rails sets as > default output encoding. > > HTML entities are handy for use in literals in your source code, but > aren''t really appropriate for your data in this case.how can i convert the data in my database to utf8? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 25, 2007, at 9:22 , Damian Rr wrote:> how can i convert the data in my database to utf8?Depends on the database. For PostgreSQL you need to * dump your database * run the dump through iconv * create a new database with the UTF8 encoding, and * load your dumpfile into the new database. Michael Glaesemann grzm seespotcode net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---