Path: csiph.com!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Michael S Newsgroups: comp.lang.c++ Subject: Re: Is EXIT_SUCCESS/EXIT_FAILURE necessary? Date: Fri, 29 Nov 2024 01:20:17 +0200 Organization: A noiseless patient Spider Lines: 188 Message-ID: <20241129012017.00002dcd@yahoo.com> References: <8463694f3a751b287c857fca181451f36eeee982.camel@gmail.com> <6OG%O.12794$vGnb.894@fx46.iad> <871pz3ngzb.fsf@nosuchdomain.example.com> <5c1e5e41d6fba5e173da099e0f7255838f45ddce.camel@gmail.com> <87iksbkm2e.fsf@nosuchdomain.example.com> <0b7c04642b0175f0dc90f52eccf671422686d60b.camel@gmail.com> <95a6e157fb62a9660116cef16278fdda93d4e814.camel@gmail.com> <20241127172405.000012c5@yahoo.com> <20241128151943.000035ec@yahoo.com> <20241129002148.00002e56@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Date: Fri, 29 Nov 2024 00:20:23 +0100 (CET) Injection-Info: dont-email.me; posting-host="47ae4f2821c4cd95c460950b0679660e"; logging-data="798622"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX189+03ZISseIPde0SgtulNyDIrwlfYQO9Y=" Cancel-Lock: sha1:0oI0xovfn/lwagV9yWMYbyQiSfw= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32) Xref: csiph.com comp.lang.c++:121067 On Fri, 29 Nov 2024 00:59:13 +0200 Paavo Helde wrote: > On 29.11.2024 00:21, Michael S wrote: > > On Thu, 28 Nov 2024 22:41:42 +0200 > > Paavo Helde wrote: > > =20 > >> On 28.11.2024 15:19, Michael S wrote: =20 > >>> On Thu, 28 Nov 2024 13:03:20 +0200 > >>> Paavo Helde wrote: > >>> =20 > >>>> On 28.11.2024 10:26, Muttley@DastardlyHQ.org wrote: =20 > >>>>> On Wed, 27 Nov 2024 14:58:18 -0500 > >>>>> James Kuyper wibbled: =20 > >>>>>> On 11/27/24 11:12, Muttley@DastardlyHQ.org wrote: =20 > >>>>>>> On Wed, 27 Nov 2024 17:24:05 +0200 > >>>>>>> Michael S wibbled: =20 > >>>>>> .... =20 > >>>>>>>> It works, but badly rather than fine. > >>>>>>>> Specifically, it works only with ASCII paths. Which, on > >>>>>>>> Windows, happen to be 2nd class. The biggest problem with > >>>>>>>> ASCII paths on Windows is =20 > >>>>>>> > >>>>>>> How can ascii paths be 2nd class (whatever that means) given > >>>>>>> that ascii is a subset of utf-8? =20 > >>>>>> > >>>>>> Because ascii is a subset of utf-8, any path name that > >>>>>> contains a character not in that subset cannot be represented, > >>>>>> which is what makes them 2nd class. =20 > >>>>> > >>>>> Huh? Any ascii text is valid in UTF-8, that doesn't make ascii > >>>>> 2nd class. The only issue comes when some idiot tries to mix > >>>>> utf-8 with 8 bit ascii code pages. =20 > >>>> > >>>> You are right, ASCII is not 2nd class because it is part of > >>>> UTF-8. It is 2nd class on Windows because MS have historically > >>>> decided to not support UTF-8 properly on Windows, in an attempt > >>>> of a futile vendor lock-in. > >>>> =20 > >>> > >>> Not sure that it was about lock in. At time Win32 was conceived, > >>> UTF8 didn't exist. At time WinNt was shipped, it still was less > >>> than a year old. Back then choosing UTF16 looked reasonable. > >>> Up to ~15 years ago it was not clear that UTF8 not just won, but > >>> won decisively, so siting on the fence, waiting for the outcome > >>> of the battle and rooting for legacy was not totally > >>> unreasonable. For what happened after that, you could not > >>> underestimated a factor of laziness. =20 > >>>> Though this is changing now, I just ran a quick test and > >>>> apparently calling setlocale(LC_ALL, "et_EE.UTF-8") now works > >>>> properly with VS2022 on Windows 10 and I can pass UTF-8 > >>>> filenames to narrow-string fopen() and they work properly. So > >>>> there is progress!=20 > >>> > >>> Can you try it with paths that are longer than 260 characters? > >>> Both prefixed with "\\?\" and non-prefixed? > >>> =20 > >> > >> Non-prefixed, _mkdir() succeeds with a path of 247 unicode > >> characters (406 bytes) and fails with 307 unicode chars (506 > >> bytes). > >> > >> Prefixed with "\\?\" _mkdir() and fopen() appeared to work fine, > >> tried up to 1275 unicode chars (2114 bytes), the largest path was: > >> > >> \\?\C:\Tmp\jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-= jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap=E6=BC=A2=E6= =BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-= est=C3=BC=C3=BC=C3=A4=C3=A4\jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC= =C3=A4=C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap= =E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap=E6=BC=A2=E6=BC= =A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4\jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est= =C3=BC=C3=BC=C3=A4=C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3= =A4=C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap=E6= =BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4\jap=E6=BC=A2=E6=BC=A2= =E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3= =BC=C3=BC=C3=A4=C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4= =C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4\jap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C=A2=E6=BC=A2=E6=BC= =A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3= =BC=C3=A4=C3=A4\jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-= jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap=E6=BC=A2=E6= =BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-= est=C3=BC=C3=BC=C3=A4=C3=A4\jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC= =C3=A4=C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap= =E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap=E6=BC=A2=E6=BC= =A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4\jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est= =C3=BC=C3=BC=C3=A4=C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3= =A4=C3=A4-jap=E6=BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4-jap=E6= =BC=A2=E6=BC=A2=E6=BC=A2-est=C3=BC=C3=BC=C3=A4=C3=A4.txt > >> > >> > >> > >> > >> Alas, the File Explorer left-hand tree failed to descend into so > >> deep directory tree (double-click in right-hand pane worked, but > >> left-hand tree was truncated at some point). When opened in > >> Notepad or Notepad++, the too long paths were changed into > >> tilde-style "short names", stripping the unicode chars: > >> > >> C:\tmp\JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1\= JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP= -ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1\JAP-ES~1.TXT > >> > >> > >> =20 > >=20 > >=20 > > Prefixed Unicode is expected to work fine. Documentation is clear > > about it. I was wondering about behavior of prefixed ASCII. I.e. > > fopen() with default locale. =20 >=20 > With default locale it did not work on my machine (i.e. produced=20 > gibberish filenames instead of expected Unicode characters), e.g.=20 > jap=C3=A6=C2=BC=C2=A2=C3=A6=C2=BC=C2=A2=C3=A6=C2=BC=C2=A2-est=C3=83=C2=BC= =C3=83=C2=BC=C3=83=C2=A4=C3=83=C2=A4-jap=C3=A6=C2=BC=C2=A2=C3=A6=C2=BC=C2= =A2=C3=A6=C2=BC=C2=A2-est=C3=83=C2=BC=C3=83=C2=BC=C3=83=C2=A4=C3=83=C2=A4-j= ap=C3=A6=C2=BC=C2=A2=C3=A6=C2=BC=C2=A2=C3=A6=C2=BC=C2=A2-est=C3=83=C2=BC=C3= =83=C2=BC=C3=83=C2=A4=C3=83=C2=A4-jap=C3=A6=C2=BC=C2=A2=C3=A6=C2=BC=C2=A2= =C3=A6=C2=BC=C2=A2-est=C3=83=C2=BC=C3=83=C2=BC=C3=83=C2=A4=C3=83=C2=A4 >=20 > However, after >=20 > setlocale(LC_ALL, ".UTF-8"); >=20 > the narrow character _mkdir() and fopen() started to work fine. >=20 > If you can set your Windows ACP to UTF-8, then the default locale > ought to work as well I guess. I think last time I tried this the > machine did not boot up any more. But this was many years ago. >=20 >=20 >=20 I did not have Japanese names in mind. I was asking about very long paths consisting of Latin characters. In my tests, which are written in C rather than in C++, they appear to work fine. So, it seems, my claim that ASCII is 2nd is either outdated or plain wrong. The OS (Win7) appears to work better than claimed by docs.