Forum: Ruby on Rails Rails/MSSQL error

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Russel C. (Guest)
on 2007-07-30 10:04

I have been encountering this error when I try to save text with
japanese characters:

DBI::DatabaseError: Execute
    OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server
      Line 1: Incorrect syntax near '20070730'.
    HRESULT error code:0x80020009
      Exception occurred.: INSERT INTO categories ([category_name],
[updated_at], [created_by], [updated_by], [description], [created_at])
VALUES('費用区分', '20070730 13:57:25', 1001, 1001, 'Expense ', '20070730

I have done all of the thing needed that makes rails support for
unicode, like installing the unicode_0.1 gem, adding the $KCODE = 'u' in
the environment.rb and
in the ApllicationController I have added:

before_filter :set_charset

  def set_charset
    @headers["Content-Type"] = "text/html; charset=utf-8"
    suppress(ActiveRecord::StatementInvalid) do
      ActiveRecord::Base.connection.execute 'SET NAMES UTF8'

Also I have put encoding: utf8 in my database.yml

But still I get the error.

What am I doing wrong?
All reply i greatly appreciated. Thanks.
This topic is locked and can not be replied to.