from the spec:

A Unicode character escape sequence represents a Unicode character. Unicode character 
escape sequences are processed in identifiers (Section 2.4.2), character literals 
(Section 2.4.4.4), and regular string literals (Section 2.4.4.5). A Unicode character 
escape is not processed in any other location (for example, to form an operator, 
punctuator, or keyword). 

unicode-escape-sequence: 
\u   hex-digit   hex-digit   hex-digit   hex-digit
\U   hex-digit   hex-digit   hex-digit hex-digit   hex-digit   hex-digit   hex-digit   
hex-digit 



-----Original Message-----
From: Unmoderated discussion of advanced .NET topics. on behalf of John Elliot
Sent: Mon 7/5/2004 22:01
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] escaped string to char
 
I noticed while testing before that \U isn't a valid escape sequence..
(i.e. no uppercase U).

John.

>-----Original Message-----
>From: Unmoderated discussion of advanced .NET topics. [mailto:ADVANCED-
>[EMAIL PROTECTED] On Behalf Of Robin Debreuil
>Sent: Tuesday, 6 July 2004 12:43 PM
>To: [EMAIL PROTECTED]
>Subject: Re: [ADVANCED-DOTNET] escaped string to char
>
>Yeah, weird eh? Right now I'm just doing it by hand like below, but I
was
>hoping for something a bit more robust, maybe flagging invalid unicode
>values or something... I just think I must be missing something in the
>framework...
>
>Oh well, thanks for looking in any case,
>Robin
>
>
>string s = @"\u0497";
>if(s[1] == ('u') || s[1] == ('U'))
>{
>    int len = s.Length / 2 - 1;
>    byte[] bts = new Byte[len];
>    for(int i = 0; i < len; i++)
>    {
>         string hexNums = s.Substring(i * 2 + 2, 2);
>         bts[len - i - 1] =  (byte)int.Parse(hexNums,
>NumberStyles.AllowHexSpecifier );
>    }
>    UnicodeEncoding ue = new UnicodeEncoding();
>    char[] cs = ue.GetChars(bts);
>    char c = cs[0];
>}
>
>===================================
>This list is hosted by DevelopMentorR  http://www.develop.com
>Some .NET courses you may be interested in:
>
>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
>http://www.develop.com/courses/gaspdotnetls
>
>View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to