This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cpplib utf8, status?


On Mon, 26 Apr 2010, Janek Kozicki wrote:

> Joseph S. Myers said:     (by the date of Mon, 26 Apr 2010 12:35:49 +0000 (UTC))
> 
> > If you wish to experiment with extended identifiers, use 
> > -fextended-identifiers.  This only supports UCNs in identifiers, not 
> > extended characters represented other than with UCNs.  Point 14 out of 15 
> > on my list is support for actual UTF-8 in identifiers.
> 
> Thank you,
> 
> Currently I have gcc version 4.4.3 20100108 (prerelease)
> (Debian 4.4.2-9), should use a newer version?

Although there are some relevant fixes in 4.5, I doubt they are relevant 
to what you want to do.

> I suppose that "raw/real" UTF-8 will not work ;)
> So how do I express UCN in the code?

By using the \uNNNN or \UNNNNNNNN syntax.  For example, pipe your code 
through

perl -pe 'BEGIN { binmode STDIN, ":utf8"; } s/(.)/ord($1) < 128 ? $1 : sprintf("\\U%08x", ord($1))/ge;'

or similar to convert extended characters to UCNs.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]