开发者

encoding problem with rails and sql server

开发者 https://www.devze.com 2023-01-30 09:17 出处:网络
I have a Rails app hooked up to a SQL server database using the \"activerecord-sqlserver-adapter\" gem. Some of the tables contain Unicode characters, which display fine if I look at them using the Mi

I have a Rails app hooked up to a SQL server database using the "activerecord-sqlserver-adapter" gem. Some of the tables contain Unicode characters, which display fine if I look at them using the Microsoft SQL Server tool, but which don't get displayed correctly on the site itself (they get replaced with the rotated box-with-question mark开发者_StackOverflow).

If I open up a console and access the field, I see something like "\xA9" for the copyright symbol (which I believe is an incorrect Unicode encoding).

What do I need to do to fix this?


I'm not sure if this applies to SQL Server, but make sure your database.yml file contains encoding: utf8 in each environment section.

0

精彩评论

暂无评论...
验证码 换一张
取 消