I ve got a legacy oracle database in ISO-8859-1 encoding, which is in
use by other applications as well.
Now, I would like to add a rails app for new features. Rails is using
unicode so special characters are stored incorrectly in the database.
Does anybody know how I might fix that. I ve already told my
controllers to use that charset, but my models still store these
values as utf8 and that goes directly into the database.
Converting the whole database to unicode is not an option due to the
other legacy apps.
hello, you should change kcode in your environment.rb : $KCODE =
'NONE' to specify ruby interpreter you don't use utf-8. and check
"encoding" parameter in database.yml.
Please do post back to tell us if Jean-Sebestien’s suggestions work. If not, for my non-rails apps, I set the NLS_LANG variable in the environment to the character set of the database before starting the web server. This might or might not help.
Unfortuently, setting the KCODE to NONE did not fix my problem. The
strings are still stored with unicode settings in my database.
I ve set the encoding in database.yml, however, so far I ve read
nowhere that the oci adapter supports that argument.
Im not sure if I understood that NLS_LANG suggestion... However, I can
assure you that I have no control at all over the other systems...
Anyone else with an idea... Maybe somebody knows about a plugin which
converts between charsets during write/read operations to the
database???
sorry, i thought it could work with it (it does with postgres and
mysql). i just find an article about using oracle with rails, i hope
it could help you: Ruby on Rails with Oracle – /bin/recykl