Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returns all strings encoded as US_ASCII? #7

Open
andy-twosticks opened this issue Jun 16, 2016 · 0 comments
Open

Returns all strings encoded as US_ASCII? #7

andy-twosticks opened this issue Jun 16, 2016 · 0 comments

Comments

@andy-twosticks
Copy link

andy-twosticks commented Jun 16, 2016

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant