Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kTuwS-0000xr-UM for pgsql-general@arkaria.postgresql.org; Sat, 17 Oct 2020 22:44:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kTuwR-0004Rk-RL for pgsql-general@arkaria.postgresql.org; Sat, 17 Oct 2020 22:44:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kTuwR-0004Rd-K0 for pgsql-general@lists.postgresql.org; Sat, 17 Oct 2020 22:44:47 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kTuwM-0003k5-3F for pgsql-general@lists.postgresql.org; Sat, 17 Oct 2020 22:44:46 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id DBF123913; Sun, 18 Oct 2020 00:44:37 +0200 (CEST) Date: Sun, 18 Oct 2020 00:44:37 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: print formated special characteres Message-ID: <20201017224437.GA14168@hjp.at> References: <20201017185136.GA11747@c720-r342378> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="huq684BweRXVnRxX" Content-Disposition: inline In-Reply-To: <20201017185136.GA11747@c720-r342378> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --huq684BweRXVnRxX Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-10-17 20:51:36 +0200, Matthias Apitz wrote: > El d=EDa s=E1bado, octubre 17, 2020 a las 03:37:46p. m. -0300, Celso Lore= nzetti escribi=F3: >=20 > > Somebody help me, please. > >=20 > > How to make the texts are aligned with 10 characters? > >=20 > >=20 > >=20 > > elog(INFO, "\n%-10s Fim\n%-10s Fim\n", "Vari=E1vel", "Variavel"); Which programming language is this? PL/pgSQL? > Hola Celso, >=20 > You can reproduce the same on the UNIX shell with: >=20 > $ printf "\n%-10s Fim\n%-10s Fim\n" "Vari=E1vel" "Variavel" >=20 > Vari=E1vel Fim > Variavel Fim Hmm. Zsh gets it right: trintignant:~ 0:31 :-) 1032% printf "\n%-10s Fim\n%-10s Fim\n" "Vari=E1vel"= "Variavel" Vari=E1vel Fim Variavel Fim As do Perl and Python. > The second test (changing the accented char '=E1' 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 '=E1' 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 --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --huq684BweRXVnRxX Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAl+Lc9EACgkQ8g5IURL+ KF2jUw/+J7d81MbakstOgmGTyPO1EYU6ID5ZkN/vuJVzdbsLbe7f2iGOMm7zTq3W 9RcC+WK1uugaR2FW9EF7OOA8KKZwlP0rgouH+7yz7yLW0/jPb4r6sgNhlHXUbC3m qAuxppeIde8FLelqAWhnW4IitI40tVjcvpSitgTTddIYvV1I+peFxe1+3iw30tZa 4SBq2diCwFHArCC7bG+kfk0bMdEm2PuIeJeYOqxvVKY4VO/644qMrnAoqwjBR+mJ WToKsjBC0Nmw3HaipwUNE7kw75/dzVug5zXdRuOV+TGecmH+b4zL9dNzrmXmjWnQ Hc5cdVEmOOKQ4MyK63CgORXqb2XqVD6PxCG1Wxm7Sq0EG/JEVapFSk3NRU4ibMMz iCWXmBZ3IRXLr7/ugBnEySpayYHfjUkR7ctPO3Py38fSzQ1cO6GFLfFW+7Yo/Ng2 PHe8N/zCiqvKWpyRJlT1ix/5P2a8U4H1Lt5qXABwb4IwpNsmhWJZqpNHHANinJAD VP6pLHHihZXv0E21HrKEMuxUk1Wj1hnFVstjAQ351U8UJIFqXqBCwJseqYYtcBCD EQPq+6COLdCduZmC+O/cNIzyKM4fRNFBBmuRDVMa18qZKsu2YtgNuVlcw+WblwX6 scYcUpYiQJAZeYcbSOeWFGF5U6TD6jVLRVV6oHf3b8o15xcaOP0= =R/I4 -----END PGP SIGNATURE----- --huq684BweRXVnRxX--