Ceàgo vs Ce?go

1 view
Skip to first unread message

Micah

unread,
Jan 15, 2010, 5:34:30 AM1/15/10
to Rails SQLServer Adapter
Howdy, thanks for open-sourcing this adapter! Its made life bearable
when dealing with SQL Server and Rails.

I've been seeing strange behavior with data that includes accents.
(Not sure if this qualifies as unicode or not, since I recall accented
letters being in the ASCII charset.)

In irb, all is well:
>> Item.find_by_RecKey("CVNSBK07C").full_description
=> "Ceàgo Vinegarden (Biodynamic) Sauvignon Blanc Kathleen's Vineyard
2007"

But if I pull the field in RSpec:
expected: "Ceàgo Vinegarden (Biodynamic) Sauvignon Blanc Kathleen's
Vineyard 2007"
got: "Ce?go Vinegarden (Biodynamic) Sauvignon Blanc Kathleen's
Vineyard 2007"

It's not just RSpec either, if I print it to a view in Rails, it
contains a question mark as well.

I've spent hours digging through the stack with the debugger, trying
to track it down, and I'm just as confused as I was before. I'm hoping
someone has already dealt with this problem, and has some ideas. Help?

josh...@gmail.com

unread,
Jan 15, 2010, 10:35:28 AM1/15/10
to Rails SQLServer Adapter
Have you tried using nchar or nvarchar as your datatype?

Micah

unread,
Jan 18, 2010, 8:23:04 PM1/18/10
to Rails SQLServer Adapter
yep, the column in sql server is a nvarchar(200).

Micah

unread,
Jan 22, 2010, 5:03:40 PM1/22/10
to Rails SQLServer Adapter
If anyone has some insight, please share!

Micah

unread,
Jan 25, 2010, 7:06:05 PM1/25/10
to Rails SQLServer Adapter
Finally tracked this one down. Turns out, its not related directly to
the sqlserver-adapter, but I'll post the solution here anyways in
hopes it saves someone else some time.

The trick is in ~/.freetds.conf:

[YOURSERVER]
host = yourserver.com
port = 1433
tds version = 7.0
text size = 64512
client encoding = UTF-8
client charset = UTF-8

Adding the last line "client charset" fixed it for me... "client
encoding" wasn't enough.

Ken Collins

unread,
Jan 25, 2010, 8:19:26 PM1/25/10
to rails-sqlse...@googlegroups.com

Thanks for posting the follow up. Sorry I could not have helped more but I am glad you go it working.

- Cheers,
Ken

> --
> You received this message because you are subscribed to the Google Groups "Rails SQLServer Adapter" group.
> To post to this group, send email to rails-sqlse...@googlegroups.com.
> To unsubscribe from this group, send email to rails-sqlserver-a...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rails-sqlserver-adapter?hl=en.
>

Reply all
Reply to author
Forward
0 new messages