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
