[Seaside] 3.9 and encoding

Philippe Marschall philippe.marschall at gmail.com
Wed Feb 28 13:18:11 UTC 2007


2007/2/28, Martial Boniou <Martial.Boniou at ifrance.com>:
> Hi,
>
> I tought I had 'corrupted' 3.9 images but it seems to be a general issue
> for 3.9. I had made the hack as Philippe said. Actually I changed the
> Dialect class>>basicIsSqueak test so that it pass well during
> installation (to get the SmalltalkImage things and not Smalltalk); I
> added a Dialect class>>basicIsSqueak39 (true for SystemVersion number >
> 7010); I subclass SqueakDatabaseAccessor to Squeak39DatabaseAccessor to
> modify the instance method #basicExecuteSQLString to say:
>
> result := connection execute: (aString asWideString convertToEncoding:
> 'utf-8').

Do you really need to send #asWideString? It doesn't look like it
would do anything if you already have a String.

Philippe

> It works well. I did it to test Ramon Leon's Seaside Blog but I didn't
> post this because I wasn't sure it was a common problem and because of
> the ugliness of the string conversion.
>
> I attach my two mods.
>
> --
> Martial
>
> Philippe Marschall a écrit :
> | 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
> |
> | Sorry that does only do the decoding and not the encoding. I guess in
> | your case Glorp does the encoding. I don't know how you can customize
> | the Sql generation there but it everything else fails you can change
> | PGConnection >> #execute (yes, this is a hack)
> |
> | sql := sqlString.
> | to
> | sql := sqlString convertToEncoding: #utf8.
> |
> | Philippe
> |
> | P.S.:
> | PGConnection >> class #buildDefaultFieldConverters
> | has given us a lot of pain because Squeak doesn't have full block closures
> |
> | >Norbert
> | >
> | >_______________________________________________
> | >Seaside mailing list
> | >Seaside at lists.squeakfoundation.org
> | >http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> | >
>
> | _______________________________________________
> | Seaside mailing list
> | Seaside at lists.squeakfoundation.org
> | http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>


More information about the Seaside mailing list