Weird encoding issues in PG 0.17.1

206 views
Skip to first unread message

Sam Saffron

unread,
Dec 28, 2014, 8:50:41 PM12/28/14
to rub...@googlegroups.com
I am encountering rather odd encoding issue in Ruby 2.2 under pg 0.17.1 


It is reproducible by running the Discourse spec suite under 2.2 

The issue is resolved when using 

gem 'pg', '0.18.0.pre20141117110243'

which raised a couple of questions?

- Did anything change around string handling (reading / writing to db in 0.18) ? 
- Are there any plans for a new stable release ... 0.17.1 is quite ancient. 


Michael Granger

unread,
Dec 28, 2014, 9:27:48 PM12/28/14
to rub...@googlegroups.com
On 28 Dec 2014, at 17:50, Sam Saffron wrote:

> I am encountering rather odd encoding issue in Ruby 2.2 under pg
> 0.17.1
>
> https://gist.github.com/SamSaffron/0f196fab3af73409b185
>
> It is reproducible by running the Discourse spec suite under 2.2
>
> The issue is resolved when using
>
> gem 'pg', '0.18.0.pre20141117110243'

Thanks for the report! There was an issue filed the day after 2.2's
release which looks to be the same bug:
https://bitbucket.org/ged/ruby-pg/issue/197/ruby-220-byte-encoding-issue.

> which raised a couple of questions?
>
> - Did anything change around string handling (reading / writing to db
> in
> 0.18) ?
> - Are there any plans for a new stable release ... 0.17.1 is quite
> ancient.

Yes, the new typecasting system Lars has been working on will be in 0.18
which I suspect is responsible for the fix. Lars can probably confirm
that and speak to the particulars.

And yes, we're planning on releasing very soon.

--
Michael Granger <g...@FaerieMUD.org>
Rubymage, Architect, Believer
The FaerieMUD Consortium <http://faeriemud.org/>

Sam Saffron

unread,
Dec 28, 2014, 10:06:09 PM12/28/14
to rub...@googlegroups.com
Awesome Michael, 

Regarding the casting issue I also see https://meta.discourse.org/t/actionview-template-error-incompatible-character-encodings-utf-8-and-ascii-8bit/19970 very erratically on very specific sites. I strongly suspect its the same issue. 

Great news on the new release, as soon as you stamp it I would love to get Discourse on it. 

Perry Smith

unread,
Dec 28, 2014, 10:23:03 PM12/28/14
to rub...@googlegroups.com
Is it time to take the bold step and call it version 1.0? :-)

--
You received this message because you are subscribed to the Google Groups "ruby-pg" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-pg+u...@googlegroups.com.
To post to this group, send email to rub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-pg/bb521332-daae-4ee8-bf67-f0a62fbd293f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lars Kanis

unread,
Dec 29, 2014, 4:32:25 AM12/29/14
to rub...@googlegroups.com
Am 29.12.2014 um 03:27 schrieb Michael Granger:
On 28 Dec 2014, at 17:50, Sam Saffron wrote:
which raised a couple of questions?

- Did anything change around string handling (reading / writing to db in
0.18) ?
- Are there any plans for a new stable release ... 0.17.1 is quite ancient.

Yes, the new typecasting system Lars has been working on will be in 0.18 which I suspect is responsible for the fix. Lars can probably confirm that and speak to the particulars.

There is a neat detail in the ruby-2.2 news, that causes this error: https://github.com/ruby/ruby/blob/v2_2_0/NEWS#L319 . The issue was fixed for pg in commit https://bitbucket.org/ged/ruby-pg/commits/f0b7f99 . It is not directly related to the typecast code, although it affected some common code paths.

Unfortunately the same change makes a bug in rails evident when using BYTEA types: https://github.com/rails/rails/pull/17680 . I'll ping them again to fix this.

Regards,
Lars

Sam Saffron

unread,
Jan 6, 2015, 3:43:38 PM1/6/15
to rub...@googlegroups.com
quick note,

we upgraded Discourse to 0.18 and all seems fine, thanks heaps for getting the release out. 
Reply all
Reply to author
Forward
0 new messages