Skip to content

Instantly share code, notes, and snippets.

@francois
Created October 25, 2012 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francois/3955094 to your computer and use it in GitHub Desktop.
Save francois/3955094 to your computer and use it in GitHub Desktop.
ASCII-8BIT vs UTF-8 failure using Sequel 3.40.0
#!/usr/bin/env ruby
# coding: utf-8
require "logger"
require "sequel"
require "sequel/extensions/pg_array"
require "json"
logger = Logger.new(STDERR)
logger.level = Logger::DEBUG
DB = Sequel.connect("postgres://localhost/repro", :encoding => "utf-8", :logger => logger)
DB.extend Sequel::Postgres::PGArray::DatabaseMethods
data = DB[<<-EOSQL].all
SELECT array_agg(keyword) FROM show_market_keywords
EOSQL
puts data.to_json
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: show_market_keywords; Type: TABLE; Schema: public; Owner: francois; Tablespace:
--
CREATE TABLE show_market_keywords (
keyword text NOT NULL,
);
COPY show_market_keywords (keyword) FROM stdin;
gérantes d'estrade
\.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment