Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: How to get a character consisting of multiple bytes into a string literal? |
| Date | 2015-10-24 13:44 -0700 |
| Organization | None to speak of |
| Message-ID | <lnbnbot2ri.fsf@kst-u.example.com> (permalink) |
| References | <n0gehd$p8k$1@solani.org> <337f4b24-de29-41fa-ac20-0f58bf0e2d5f@googlegroups.com> |
Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
> On Saturday, October 24, 2015 at 6:18:56 PM UTC+1, Philipp Klaus Krause wrote:
>> Assuming my implementation supports the basic source character set, how
>> can I create a string literal that contains multibyte character
>> consisting of multiple bytes?
>>
> Depends how you want to pass the data about.
>
> You can use the L prefix L"Wide chars"; to create a 16-bit string
> literal.
A string literal prefixed with L represent a sequence of wchar_t
elements. wchar_t is typically 16 bits on Windows, but 32 bits on
Unix-like systems.
> Or you use use UTF-8 and write char *str = "utf-8 is ascii
> with extended characters like aleph (\xe2\x84\xb5)";
Or, if your compiler supports it, u8"..." is a UTF-8 string literal,
u"..." represents a sequence of char16_t, and U"..." represents a
sequence of char32_t. These are new in C11.
> The second method is OK for a few embedded non-English characters,
> but not human-maintainable for flowing text, so realistically you'll
> need a tool to generate the literals.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to get a character consisting of multiple bytes into a string literal? Philipp Klaus Krause <pkk@spth.de> - 2015-10-24 19:18 +0200
Re: How to get a character consisting of multiple bytes into a string literal? James Kuyper <jameskuyper@verizon.net> - 2015-10-24 14:06 -0400
Re: How to get a character consisting of multiple bytes into a string literal? Philipp Klaus Krause <pkk@spth.de> - 2015-10-24 20:39 +0200
Re: How to get a character consisting of multiple bytes into a string literal? James Kuyper <jameskuyper@verizon.net> - 2015-10-24 15:05 -0400
Re: How to get a character consisting of multiple bytes into a string literal? Richard Damon <Richard@Damon-Family.org> - 2015-10-24 14:07 -0400
Re: How to get a character consisting of multiple bytes into a string literal? James Kuyper <jameskuyper@verizon.net> - 2015-10-24 14:33 -0400
Re: How to get a character consisting of multiple bytes into a string literal? Philipp Klaus Krause <pkk@spth.de> - 2015-10-24 21:30 +0200
Re: How to get a character consisting of multiple bytes into a string literal? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-24 11:11 -0700
Re: How to get a character consisting of multiple bytes into a string literal? Keith Thompson <kst-u@mib.org> - 2015-10-24 13:44 -0700
Re: How to get a character consisting of multiple bytes into a string literal? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-10-24 19:18 +0100
Re: How to get a character consisting of multiple bytes into a string literal? Tim Rentsch <txr@alumni.caltech.edu> - 2015-10-24 11:57 -0700
Re: How to get a character consisting of multiple bytes into a string literal? Philipp Klaus Krause <pkk@spth.de> - 2015-10-24 21:32 +0200
Re: How to get a character consisting of multiple bytes into a string literal? James Kuyper <jameskuyper@verizon.net> - 2015-10-24 15:54 -0400
Re: How to get a character consisting of multiple bytes into a string literal? Tim Rentsch <txr@alumni.caltech.edu> - 2015-10-24 14:43 -0700
Re: How to get a character consisting of multiple bytes into a string literal? Philipp Klaus Krause <pkk@spth.de> - 2015-10-25 10:38 +0100
Re: How to get a character consisting of multiple bytes into a string literal? Tim Rentsch <txr@alumni.caltech.edu> - 2015-10-25 10:05 -0700
csiph-web