[Seaside] 3.9 and encoding

Norbert Hartl norbert at hartl.name
Wed Feb 28 22:41:59 UTC 2007


On Wed, 2007-02-28 at 10:03 +0100, Philippe Marschall wrote:
> 2007/2/28, Norbert Hartl <norbert at hartl.name>:
> > On Wed, 2007-02-28 at 00:26 +0100, Philippe Marschall wrote:
> > > 2007/2/28, Norbert Hartl <norbert at hartl.name>:
> > > > Hi,
> > > >
> > > > I ran into a encoding problem. I'm using seaside together
> > > > with Glorp. For the web server I use WAKomEncoded39.
> > > > WAKomEncoded39 converts the output to the browser to utf-8.
> > > > But on incoming requests the url escaped characters are
> > > > translated to something different. For me it appears to
> > > > be latin-1 but I've no glue why it should be that way.
> > > > I detected it because my postgresql session has client
> > > > encoding utf-8 turned on and I get an error trying to
> > > > store strings containing characters like ö.
> > >
> > > If you run WAKomEncoded39 on Squeak 3.9 you will have strings with
> > > (new) Squeak encoding in your image which is basically non-unified
> > > unicode. For latin-1 characters this will be indistinguishable from
> > > latin-1. If your database is utf-8 you need to encode your strings to
> > > utf-8 when writing them to your database and decode your strings from
> > > utf-8 when reading from the database (only to convert it back to utf-8
> > > when generating html). You can configure the PostgreS database driver
> > > to do this automatically for you.
> > >
> > Oh, this seems quite easy. But I didn't found anything to configure
> > in the Postgres driver. Do you have any hint?
> 
> PGConnection >> class #buildDefaultFieldConverters
> TestPGConnection >> #testFieldConverter
> 
> You need to register a field converter for your string types that does
> #convertFromEncoding: #utf8
> 
Yes, you are right. For everybody who wants to know. You can fix it by
adding 

#(1043 )
   do: [:each| converters at: each put: [:s | s convertFromEncoding:
#utf8]].

to PGConnection class>>buildDefaultFieldConverters

Hmmm, I guess I talk to Yanni about this.

regards,

Norbert



More information about the Seaside mailing list