Skip to content
This repository was archived by the owner on Jan 10, 2026. It is now read-only.
This repository was archived by the owner on Jan 10, 2026. It is now read-only.

Returns all strings encoded as US_ASCII? #7

Description

@andy-twosticks

I get this behaviour when connected to a database encoded as UTF-8.

Example Code:

require 'postgres-pr/connection'
c = PostgresPR::Connection.new('blah', 'blah', 'blah')

row = c.query("select name, cost from remedium.prescription").rows.last
row.each do |f|
  #f.force_encoding(Encoding::UTF_8) #-- uncomment this to 'fix' everything ;/

  enc = f.kind_of?(String) ? f.encoding : ''
  puts [f.class, f, f.inspect, enc].join(' ')
end

Output:

String Paracelsium "Paracelsium" ASCII-8BIT
String £0.00 "\xC2\xA30.00" ASCII-8BIT

I don't know what you can do to resolve this -- but other adapters don't appear to have this problem, so I suppose it must be technically possible to resolve it. [Ruby 2.3; Postgres 9.2]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions