Re: print formated special characteres - Mailing list pgsql-general

From Matthias Apitz
Subject Re: print formated special characteres
Date
Msg-id 20201017185136.GA11747@c720-r342378
Whole thread Raw
In response to print formated special characteres  ("Celso Lorenzetti" <celso@sysrs.com.br>)
Responses Re: print formated special characteres  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
List pgsql-general
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");

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


$ printf "\n%-10s Fim\n%-10s Fim\n" "VariXvel" "Variavel"

VariXvel   Fim
Variavel   Fim

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.

I have no solution, though at the moment...

Obrigado

    matthias

-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
Без книги нет знания, без знания нет коммунизма (Влaдимир Ильич Ленин)
Without books no knowledge - without knowledge no communism (Vladimir Ilyich Lenin) 
Sin libros no hay saber - sin saber no hay comunismo. (Vladimir Ilich Lenin)



pgsql-general by date:

Previous
From: "Celso Lorenzetti"
Date:
Subject: print formated special characteres
Next
From: "Peter J. Holzer"
Date:
Subject: Re: print formated special characteres