Re: pmap: German umlauts are shown as question marks

"Dr. Werner Fink" <[email protected]> Thu, 7 Nov 2024 10:08:10 +0100
Newsgroups gmane.linux.procps.devel
Message-ID <[email protected]>
--+kPX84iZXtnFGcCn
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2024/11/07 19:50:46 +1100, Craig Small wrote:
> Should this string be parsed as a wide string and use iswprint() instead?

I also had this idea, this would require mbstowcs(3) or mbsrtowcs(3) to
convert a multibyte string like UTF-8 to wide chracter type wint_t ...
this requires some more coding for detecting invalid bytes in a
multibyte string ... in comparison using mblen(3) seesm to be somewhat simp=
ler

>=20
> On Tue, 5 Nov 2024 at 23:09, Dr. Werner Fink <[email protected]> wrote:
>=20
> > On 2024/11/05 11:53:33 +0100, Dr. Werner Fink wrote:
> > > On 2024/11/05 09:23:16 +0100, Daniel Hofstetter wrote:
> > > > Hi,
> > > >
> > > > I noticed that if I have a binary with German umlauts, the umlauts =
are
> > > > shown correctly in the first line but not in the memory map. There,
> > > > they are shown as question marks:
> > > >
> > > > $ pmap 19508
> > > > 19508:   ./target/debug/hello_=C3=A4=C3=B6=C3=BC
> > > > 00005db66dc51000     20K r---- hello_??????
> > > > 00005db66dc56000    264K r-x-- hello_??????
> > > > 00005db66dc98000     52K r---- hello_??????
> > > > 00005db66dca5000     12K r---- hello_??????
> > > > 00005db66dca8000      4K rw--- hello_??????
> > >
> > > There are two places where isprint(3) is checking the bytes of the
> > remaining
> > > path in /proc/<pid>/maps ... UTF-8 encoding are multibyte characters
> > means
> > > such multibyte characters are mapped to `?' for each byte.
> > >
> >
> > A dirty hack for checking for (multi)byte characters with mblen(3)
> > ... strlen(3) usage could be optimized indeed.
> >
> > --
> >   "Having a smoking section in a restaurant is like having
> >           a peeing section in a swimming pool." -- Edward Burr
> >

--=20
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

--+kPX84iZXtnFGcCn
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJgBAABCABKFiEEGwa/WjgpkPvLonW+UOkNVR3Bay4FAmcsg3EsFIAAAAAAFQAO
cGthLWFkZHJlc3NAZ251cGcub3Jnd2VybmVyQHN1c2UuZGUACgkQUOkNVR3Bay73
dhAArKtnbzcc41IRjuywFOsQAcFPUtqymiFMRJrNZ9IuMnD35KR8DizTUYPUfVad
mQ4xFON4leJy7+feXh5eCrssah1FQZTEuI/syYwXHE7kYr1drXMb3JX71jbOy8u0
Qz+NTL+Htl7vUkJssj88FdLDt0JYrzTdb7ggeFQbR6ScFJ3KPHmRGgtN84HYsij+
RB5RYkoudgGIDXmm84H9Ijcsa28iSRYmueJ6fACUcIfoyUWj7g1rSyZaZ5veTF9E
eFIV73KU9JJYkA7bScBc3diijQPASNIgCrqS+BwV/hCmXJTJSXBr2Uacja8YuR2h
EOpSnEyTjTW8q9FHYf61Kxo+wsrH4kyF3dBH6P0f36pReoWYg99lmq6ezpgnnEZ+
GhwXQ52GKvA7EA/cxLjeu9RqEYCWM0m61malqDe1LoeS1gMQPbGac05w1GluEWQk
waQ5ArC1LQ6kfBdcDpD6VmK64J5d4BdylCR8LamPPpAB+4xkq1/sWD+m4SJS/v/t
EYRi2hZ8JcyFLApYIWzLve85WAnDAG/un2CYKUdPQ06HtmyWPGFJ8+eP1BgDXpeC
thNdJ6kaZQ3YpJl16WAe58COebtVN+4/Yq+jghgzaVyDFasFwpz0jKsGJ4JOaGI4
S8ifEE0afYl+Tupqe6kAfSxYKNKlSxP+XRZCZi/VfWAva5o=
=zzMa
-----END PGP SIGNATURE-----

--+kPX84iZXtnFGcCn--