Created
October 25, 2012 20:07
-
-
Save francois/3955094 to your computer and use it in GitHub Desktop.
ASCII-8BIT vs UTF-8 failure using Sequel 3.40.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- 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