Re: [PATCH] Formatting patch for psql

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCH] Formatting patch for psql
Date: 2005-11-24 22:57:07
Message-ID: 20051124225705.GD29774@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Thu, Nov 24, 2005 at 11:35:11PM +0100, Peter Eisentraut wrote:
> Martijn van Oosterhout wrote:
> > On Thu, Nov 24, 2005 at 03:45:12PM +0100, Peter Eisentraut wrote:
> > > Shouldn't you use PQmblen() to determine whether an encoding is
> > > single-byte, rather than having an enumerated list?
> >
> > Actually, thinking about it the answer is no. The code is relying on
> > the fact that it's a charset that has ASCII as a subset.
>
> Which code does that?

Well, the code you're referring to: the two places where it enumerates
the encodings in my patch. That code basically understands \n as going
to the next line, but that's ASCII.

What I beleive you were suggesting was to replace the switch statement
with something like

if(PQmblen(...) == 1)
{ code for latin1 }
else if( encoding == UTF8 )
{ code for utf8 }
else
{etc}

And what I'm saying is that you can only do that if all single byte
encodings are ASCII compatable and I'm not prepared to say that...

So in the switch statement I listed the encodings I know to be ASCII
compatable and at some point someone who actually knows the other
encodings will explain what needs to be done.

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-11-25 02:23:55 Re: [PATCH] Formatting patch for psql
Previous Message Peter Eisentraut 2005-11-24 22:35:11 Re: [PATCH] Formatting patch for psql