[Pharo-dev] Glorp Login>>#encodingStrategy

Sven Van Caekenberghe sven at stfx.eu
Thu Aug 28 17:57:23 EDT 2014

On 27 Aug 2014, at 18:20, Esteban A. Maringolo <emaringolo at gmail.com> wrote:

> 2014-08-27 12:38 GMT-03:00 Sven Van Caekenberghe <sven at stfx.eu>:
>> It seems that Glorp Login>>#encodingStrategy is not used by the NativePostgresDriver yet it is required to set it to a non nil value to get things working. This feels like a hack or something unfinished.
> How so?
> PGConnection>>#clientEncoding: sets instance variables
> sqlStringConverter and receivingTextConverter, which are used to
> convert text back and forth from Pharo to the socket (see
> PGConnection>>#execute:)
> It is really convoluted, but I guess this has to do with the pass of
> time, and also with the half-backed (IMO) driver independence and
> dialect compatibility.
> Regards!
> Esteban A. Maringolo

Thanks for your answer.

I was confused by the name change between encodingStrategy and clientEncoding. You are right it is used. But my point remains that unless you set encodingStrategy on Login to something you get an error when nil in converted to a Symbol (in #connectionArgsFromCurrentLogin:). Now, I set it to #default which does not exist as encoding and leads to no encoding at all. That seems to indicate that it is not needed, but I am not sure.


The before last line of #connectionArgsFromCurrentLogin: could be changed to

aLogin encodingStrategy ifNotNil: [ :enc | connectionArgs clientEncoding: enc asSymbol ].

More information about the Pharo-dev mailing list