Skip to content

ActionView::Template::Error: PG::CharacterNotInRepertoire: ERROR: invalid byte sequence for encoding "UTF8": 0xee 0x63 0x68

https://sentry.gitlap.com/gitlab/gitlabcom/issues/214450/

PG::CharacterNotInRepertoire: ERROR:  invalid byte sequence for encoding "UTF8": 0xee 0x63 0x68

  peek/views/pg.rb:17:in `async_exec'
    super(*args)
  peek/views/pg.rb:17:in `async_exec'
    super(*args)
  active_record/connection_adapters/postgresql_adapter.rb:592:in `block in exec_no_cache'
    log(sql, name, binds) { @connection.async_exec(sql, []) }
  active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
    :binds          => binds) { yield }
  active_support/notifications/instrumenter.rb:20:in `instrument'
    yield payload
...
(214 additional frame(s) were not displayed)

ActiveRecord::StatementInvalid: PG::CharacterNotInRepertoire: ERROR:  invalid byte sequence for encoding "UTF8": 0xee 0x63 0x68
: SELECT  1 AS one FROM "emails" WHERE "emails"."user_id" = 1832781 AND ("emails"."confirmed_at" IS NOT NULL) AND "emails"."email" =...

Sample user info is not UTF-8:

u = User.find_by(1832781)
 u.gpg_keys.first.user_infos.each { |x| puts x; puts x[:email].encoding }
<snip>
{:name=>"Uwe Henschel", :email=>"\xEEch@uwe-henschel.de"}
ASCII-8BIT
Edited by Stan Hu