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
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 G.
grzm seespotcode net
Bob S. wrote:
On 6/19/07, Damian Rr [email protected] 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.
how can i convert the data in my database to utf8?
On 6/19/07, Damian Rr [email protected] 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.