Re: indent mangles UTF-8

Petr Pisar <[email protected]> Mon, 27 Mar 2023 10:53:23 +0200
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <ZCFZg4uQUn/[email protected]>
--EgPCyRSuaTd/TzAi
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

V=C2=A0Fri, Mar 24, 2023 at 11:01:04AM -0700,=C2=A0Adam Wozniak napsal(a):
> Using "indent" on a C file with structure members with UTF-8 names (as
> allowed under C99 and later).
>=20
> indent completely mangles these member names, inserting spaces between UT=
F8
> bytes.
>=20
> -double =C9=9914(double GST, struct =CF=86=CE=BB =CF=86=CE=BB) {

C99 leaves Unicode characters in identifiers as an implementation-defined
option:

    An implementation may allow multibyte characters that are not part of t=
he
    basic source character set to appear in identifiers; which characters a=
nd
    their correspondence to universal character names is
    implementation-defined.

You probably mistaken Unicode characters with Unicode character names
(a sequence like \uNNNN and \UNNNNNNNN):

    Universal character names may be used in identifiers, character constan=
ts,
    and string literals to designate characters that are not in the basic
    character set.

Hence C99-conforming compiler must support:

    double =C9=9914(double GST, struct \u03c6\u03bb \u03c6\u03bb);

but may support:

    double =C9=9914(double GST, struct =CF=86=CE=BB =CF=86=CE=BB);

while the interoperbility of the latter (e.g. linking to compilation units
together) is completely unspecified.

I don't say that cindent could not support Unicode characters (probably
depending on a locale because indent needs understand them to align columns
properly). Only that your claim about UTF-8 support in C99 is misleading.

-- Petr

--EgPCyRSuaTd/TzAi
Content-Type: application/pgp-signature; name="signature.asc"

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

iQIzBAABCAAdFiEE4/QvzhVoMKgDWObpT9GuwzZa978FAmQhWXkACgkQT9GuwzZa
97+jJhAAyT+u99O/jYwgPp9LU7C/buXcoz0p9ZEeu6gzWaAVkKpmM5apDHoVAiXl
6UIRTWpEv/Pd2LL5I/hSE7opsWGTeTKpzq0DrfcmhX+bdj+gmTuDghD9oDezN42p
y4IovGk+LBvGrH7/15SCbXE9Si1NnmI+/HgBhDYsNCo4nSCFMOfgKc5AlVZ1POOZ
BxZtLjvyQfCUiwLr5fi+tvNLH2W8G0MB3l58MbBq5c8wQ0SkuVwMPZNc56UhRwLT
y2gnydGRdsh0UvE5FwM2sZliCUGIbsTDk3tCIfGwVg/tcEam9U6zQbBWztkjGczu
QBSGQxYrngGFrbnhnyXLPm+f+OTDoEC+81lqZvZa84OoX6s+jtcRT2f5trMiYe8y
QCsiNR9vSByT2tFUDrvAbxeNCpIIzGePoNPVZJ1/Sokwnt0V9OrW3awF4r+nWh07
aqKJ+2BpTaup4cv0qIlLTYOrMWNvlzl7c5AfYbFziqVZUtQo4Q4PEKvp2f/gqlfF
I+mh+QnGUzQd66ycrtjHH0tF5EdfL2V4ty1U5Xj5470OnpwPnBL5Vfyio+hV6LyW
3/wm62jq/sXx9wrRIypO50NNFHizVEd6B4wyOIFTwgc9qLtC3xb3PfjEUjo3oCBG
qQN188JBBPx45PD/9ugAqvEObm8F2fKybqEeb61/u5Yha1SsK/4=
=w1ej
-----END PGP SIGNATURE-----

--EgPCyRSuaTd/TzAi--