RES: print formated special characteres

From: "Celso Lorenzetti" <celso(at)sysrs(dot)com(dot)br>
To: "'Peter J(dot) Holzer'" <hjp-pgsql(at)hjp(dot)at>, <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: RES: print formated special characteres
Date: 2020-10-19 01:18:14
Message-ID: !&!AAAAAAAAAAAYAAAAAAAAAGBFA8ifz6xFmE1BXn1p/rXCgAAAEAAAANs5E2rXZXJMnM5DDDqMZF8BAAAAAA==@sysrs.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Peter,

is language C standart..

On 2020-10-17 20:51:36 +0200, Matthias Apitz wrote:
> El día sábado, octubre 17, 2020 a las 03:37:46p. m. -0300, Celso
Lorenzetti escribió:
>
> > Somebody help me, please.
> >
> > How to make the texts are aligned with 10 characters?
> >
> >
> >
> > elog(INFO, "\n%-10s Fim\n%-10s Fim\n", "Variável", "Variavel");

Which programming language is this? PL/pgSQL?

> Hola Celso,
>
> You can reproduce the same on the UNIX shell with:
>
> $ printf "\n%-10s Fim\n%-10s Fim\n" "Variável" "Variavel"
>
> Variável Fim
> Variavel Fim

Hmm. Zsh gets it right:

trintignant:~ 0:31 :-) 1032% printf "\n%-10s Fim\n%-10s Fim\n" "Variável"
"Variavel"

Variável Fim
Variavel Fim

As do Perl and Python.

> The second test (changing the accented char 'á' by 'X'), shows that
> the problem/bug is a) more generic, not only in PostgreSQL and b) has
> todo with being the UTF-8 char 'á' a two byte char, while 'X' is only
> one byte.

Yes, determining how much space a UTF-8 sequence occupies on screen is
surprisingly hard. I'm not sure what the C standard says about that. But
these days I would expect any programming language to get it right at least
for the simple cases.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

--
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Celso Lorenzetti 2020-10-19 01:24:41 RES: print formated special characteres
Previous Message Bo Peng 2020-10-18 02:19:33 Re: Pgpool2 Service Won't Start