Hi all, Quick question: I''ve got a legacy schema imported to MySQL from Access over ODBC in the cp1251 character set. I''m using some ActiveRecord duct tape to migrate it to a new design, which needs to be in utf-8. Is there any way I can tell the models referring to the legacy data to do an automatic Iconv.iconv() on any text fields when they''re read? I can overwrite individual accessors, but that gets boring quickly, and I might miss one. Any smart ideas? Anyone else run into this? Thanks, -- Alex
On 9/7/05, Alex Young <alex-qV/boFbD8Meu8LGVeLuP/g@public.gmane.org> wrote:> Is > there any way I can tell the models referring to the legacy data to do > an automatic Iconv.iconv() on any text fields when they''re read? I can > overwrite individual accessors, but that gets boring quickly, and I > might miss one.If you imported it to MySQL, do you still have any app that needs to have access to the data as cp1251? If not, you could just dump the data, and convert the .sql file into utf-8 with iconv. This way, you won''t have to thinker with complicated things like converting character sets on the fly everytime you access this legacy data... -- Michel Valdrighi Devéloppeur Web Intraordinaire http://zengun.org/weblog/
Michel Valdrighi wrote:> If you imported it to MySQL, do you still have any app that needs to > have access to the data as cp1251? If not, you could just dump the > data, and convert the .sql file into utf-8 with iconv. > This way, you won''t have to thinker with complicated things like > converting character sets on the fly everytime you access this legacy > data... >True. I''ve actually done the manual overriding thing now, so it''s less of an issue. It''s an interesting problem, though - it might come in very handy to be able, for example, to convert character sets on the fly when you don''t know the destination character set in advance. Any technique that let you apply an arbitrary filter to certain classes of column would be really nice - especially for debugging. -- Alex