Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Philipp Klaus Krause <pkk@spth.de> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: UTF-8 with C, simply |
| Date | 2016-11-28 21:53 +0100 |
| Organization | solani.org |
| Message-ID | <o1i5h0$ik1$1@solani.org> (permalink) |
| References | <6a3e7ab3-eb0d-4794-befb-adae3729c746@googlegroups.com> <chine.bleu-609ECD.07001928112016@news.eternal-september.org> |
On 28.11.2016 16:00, Siri Cruise wrote: > In article <6a3e7ab3-eb0d-4794-befb-adae3729c746@googlegroups.com>, > luser droog <luser.droog@gmail.com> wrote: > >> I knew nothing of the mbtowc and friends except that they >> existed but didn't seem to describe anything useful to me. >> I never got the connection that the wc could be the ucs2 or >> ucs4 code and the mb could be the corresponding utf8 code. >> But James's recent post about the file mode and fgetwc lead >> me to this setup: > > I found the documentation too indecisive, making it sound like I would have to > run test programs to figure out what's going on. > > The conversion between unicode and UTF-8 is very simple intentionnally. So I use > a library like Tcl which explicitly states it is exactly UTF-8 and unicode or I > just write my own. For any other conversions I use iconv with char strings and > explicitly given character encoding names. > These days most sane implementations (and probably and implementation that matters to you) will use Unicode for char16_t, char32_t and wchar_t. I wouldn't bother with runtime checks, and instead just check for the relevant macros (__STDC_UTF_16__, __STDC_UTF_32__, __STDC_ISO_10646__) at compile time, just to give a proper #error in case someone compiles my code on something where it wouldn't work. Unfortunately, for UTF-8 the situation is more complicated. Philipp
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
UTF-8 with C, simply luser droog <luser.droog@gmail.com> - 2016-11-27 18:09 -0800
Re: UTF-8 with C, simply James Kuyper <jameskuyper@verizon.net> - 2016-11-27 22:05 -0500
Re: UTF-8 with C, simply Lorinczy Zsigmond <zsiga@nospam.for.me> - 2016-11-28 09:42 +0100
Re: UTF-8 with C, simply James Kuyper <jameskuyper@verizon.net> - 2016-11-28 09:10 -0500
Re: UTF-8 with C, simply Philipp Klaus Krause <pkk@spth.de> - 2016-11-28 21:55 +0100
Re: UTF-8 with C, simply "James R. Kuyper" <jameskuyper@verizon.net> - 2016-11-28 16:18 -0500
Re: UTF-8 with C, simply Siri Cruise <chine.bleu@yahoo.com> - 2016-11-28 07:00 -0800
Re: UTF-8 with C, simply Philipp Klaus Krause <pkk@spth.de> - 2016-11-28 21:53 +0100
Re: UTF-8 with C, simply Keith Thompson <kst-u@mib.org> - 2016-11-28 21:38 -0800
Re: UTF-8 with C, simply Nobody <nobody@nowhere.invalid> - 2016-12-01 01:52 +0000
Re: UTF-8 with C, simply luser droog <luser.droog@gmail.com> - 2016-11-30 18:20 -0800
Re: UTF-8 with C, simply luser droog <luser.droog@gmail.com> - 2016-11-30 18:25 -0800
Re: UTF-8 with C, simply luser droog <luser.droog@gmail.com> - 2016-11-30 18:28 -0800
csiph-web