Postgres / Glorp

Ramiro Diaz Trepat ramirodt at gmail.com
Mon May 14 01:54:21 UTC 2007


One more question.
Is there a way to test if a String is valid in some encoding, or to
test if a particular string is already in UTF8 ?
Because, if I want to force all my string attributes to be in UTF8, I
have to know if the String I am getting is already encoded.

In my example class Person, it would be great if I could do something like:

Person>>lastName: aLastName
    lastName := aLastName ifNotNil: [ (UTF8Tools isUtf8: aLastName)
         ifTrue: [ aLastName ]
         ifFalse: [ aLastName isoToUtf8 ]]




On 5/13/07, Ramiro Diaz Trepat <ramirodt at gmail.com> wrote:
> Indeed, probably another great thing it would  be if I could configure
> Seaside to directly send me utf8 strings from the input taken on a
> form´s entry fields.
> Is it possible?
>
>
> On 5/13/07, Ramiro Diaz Trepat <ramirodt at gmail.com> wrote:
> > Hello Todd and Marcelo,
> >    I am using Squeak 3.9.
> >    I know about how to set the encoding on postgres.  Indeed, utf8 is
> > the encoding I need on the database.
> >    What I want to know is if there is any place on the Postgres, Glorp
> > or MagritteGlorp packages where I could configure for the strings to
> > be translated to Squeak´s default (I think it´s iso).
> >    If I have, for example a Person on Glorp, and I want to set a last
> > name like mine Díaz (with an accented vowel), coming from a Magritte
> > form for instance, on the setter I translate it to UTF8 (#isoToUtf8)
> > before I assign it to my class i.var.  And it gets stored on the
> > database with no errors.  Later on, when Glorp "hydrates" my instance,
> > of course it brings a weird string like  "DÃ≈az", instead of "Díaz".
> >    Of course I would love that conversion to happen automatically with
> > a little configuration.
> >    Otherwise, what are you guys doing?
> >
> >
> >
> > On 5/13/07, marcelo Cortez <jmdc_marcelo at yahoo.com.ar> wrote:
> > > Ramiro
> > >
> > >  I'm postgres user , i hope help you , postgres
> > > encondig can be configurated at database creation,
> > > postgres client can configurated using statements
> > > SET CLIENT_ENCODING TO 'value';
> > > take a look at
> > > http://www.postgresql.org/docs/8.2/static/multibyte.html
> > > best regards
> > > mdc
> > >
> > >
> > >
> > > --- Ramiro Diaz Trepat <ramirodt at gmail.com> escribió:
> > >
> > > > Well... sorry for building this thread by myself.
> > > > The issue now is that conversion does not happen
> > > > automatically.  I can
> > > > properly store a string on a UTF8 database, by
> > > > previously converting
> > > > it using #isoToUtf8.
> > > > But when strings come back after a query (using
> > > > Glorp), they are not
> > > > converted to iso, and hence they show all screwed
> > > > up.
> > > > Is there any place in Glorp or the Postgres driver
> > > > to configure the
> > > > encoding of the underlying database for these
> > > > conversions to happen
> > > > automatically?
> > > > Thanks !
> > > >
> > > > r.
> > > >
> > > >
> > > > On 5/13/07, Ramiro Diaz Trepat <ramirodt at gmail.com>
> > > > wrote:
> > > > > Sorry, it does work.
> > > > > I don´t know what happend.
> > > > >
> > > > >
> > > > > On 5/13/07, Ramiro Diaz Trepat
> > > > <ramirodt at gmail.com> wrote:
> > > > > > I was unable to use databases with UTF8
> > > > encoding, only SQL_ASCII
> > > > > > encoding worked for me.
> > > > > > is it something trivial to configure that I did
> > > > not see or is it a limitation?
> > > > > > Thanks
> > > > > >
> > > > > > r.
> > > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > __________________________________________________
> > > Preguntá. Respondé. Descubrí.
> > > Todo lo que querías saber, y lo que ni imaginabas,
> > > está en Yahoo! Respuestas (Beta).
> > > ¡Probalo ya!
> > > http://www.yahoo.com.ar/respuestas
> > >
> > >
> > >
> >
>


More information about the Squeak-dev mailing list