Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #92357
| From | MarioCCCP <NoliMihiFrangereMentulam@libero.it> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: unicode string manipulation and file I/O |
| Date | 2023-10-04 18:24 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <ufk3js$cj06$1@dont-email.me> (permalink) |
| References | <ufhg0a$3l3bg$1@dont-email.me> <ufim4l$s1$1@dont-email.me> |
On 04/10/23 05:28, James Kuyper wrote: > On 10/3/23 12:37, MarioCCCP wrote: >> >> I have been away from C++ for too long and I am very confused >> (particularly with the differences between wchar_t strings and unicode >> strings, like UTF-8). > The execution character set has a multibyte encoding that is used by > most standard library routines that that take arguments as strings of > [[un]signed] char. It could use UTF-8 (or even UTF-16, if CHAR_BIT >= > 16), but it is not required to do so. > > wchar_t uses a fixed-length encoding capable of encoding every supported > character. It could have a Unicode encoding, either UTF-32, or UCS-2 if > the set of supported characters is sufficiently restricted, but it is > not required to. > > The C++ standard incorporates by reference functions for converting > between those encodings: > The <cwchar> header declares routines for converting between wchar_t and > multi-byte strings: std::mbstowcs(), std::wcstombs(), std::wbtowc(), and > std::wctomb(). std::wcrtomb() std::mnbrtowc(), std::mbstowcs(), > std::wcsrtombs(). Their definitions are not in the C++ standard itself, > but incorporated by reference from the C standard. > > char8_t, char16_t, and char32_t are newer typedefs used to store strings > in UTF-8, UTF-16, or UTF-32 format. > > The <cuchar> header defines routines for converting between the > multi-byte and any of the UTF-N encodings, with names like mbrtoc8() and > c8rtomb() (and similarly for c16 and 32). Their definitions are also > incorporated by reference from the C standard. > > Combining those routines, you can use multi-byte strings as an > intermediary to convert between any pair of the other encodings > mentioned above. tnx for the detailed compendium. I'll try to go through all this ! Ciao -- 1) Resistere, resistere, resistere. 2) Se tutti pagano le tasse, le tasse le pagano tutti MarioCPPP
Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread
unicode string manipulation and file I/O MarioCCCP <NoliMihiFrangereMentulam@libero.it> - 2023-10-03 18:37 +0200
Re: unicode string manipulation and file I/O Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-03 18:40 +0200
Re: unicode string manipulation and file I/O MarioCCCP <NoliMihiFrangereMentulam@libero.it> - 2023-10-03 20:14 +0200
Re: unicode string manipulation and file I/O James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-03 23:28 -0400
Re: unicode string manipulation and file I/O MarioCCCP <NoliMihiFrangereMentulam@libero.it> - 2023-10-04 18:24 +0200
csiph-web