Hi,
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
13:57:25’)
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’
end
end
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.