【发布时间】:2015-01-01 11:19:39
【问题描述】:
我正在升级 Rails 4.1 应用程序以使用 Ruby 2.2。在升级过程中,发现该应用程序使用旧版本的 pg gem (0.12) 并且 gem 没有使用 Ruby 2.2 安装。所以我尝试使用更新版本的 pg gem (0.17.1)。现在在系统中创建新用户时有时会出现以下错误:
PG::CharacterNotInRepertoire:错误:编码“UTF8”的字节序列无效
Ruby 2.2 和 Postgres 是否存在任何已知问题?
看起来应用程序配置为使用 unicode:config.encoding = "utf-8" 在 application.rb 中设置,encoding: unicode 在 database.yml 中
SQL语句:
INSERT INTO "users" (
"confirmation_sent_at",
"confirmation_token",
"created_at",
"email",
"encrypted_password",
"first_name",
"last_name",
"updated_at")
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
RETURNING "id"
【问题讨论】:
-
我尝试使用 pg 0.17.1 和 ruby 2.1.5 并且没有编码错误
-
@RustamA.Gasanov:这不是重复的,错误不是源于用户输入,在升级到 ruby 2.2 之前也没有发生
标签: ruby-on-rails ruby postgresql