Geeks With Blogs

Tim Huffam Dotting the I and crossing the T of I.T.

For each character in the string this displays:

  1. The character
  2. It's unicode character code in hex
  3. It's unicode character code number

   string text = "0 a+…”";
   foreach (char c in text)
   {
      Console.WriteLine("{0} U+{1:x4} {2}", c, (int)c, (int)c);
   }

HTH

Tim

Posted on Thursday, May 25, 2006 12:28 PM C# .NET , ASP.NET | Back to top


Comments on this post: How to get ascii/unicode character codes using C#.NET

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
pls. send me code.
Left by ta on Oct 25, 2006 8:01 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
I need the code
Left by Tanzeel on Feb 14, 2007 5:20 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Thanks Champ,
I was damn stucked in this UNICODE stuff. But good hint in your example solved my many problems.

Thanks again : )

Prasad.
Left by Prasad on Apr 23, 2007 8:14 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
I need the code also
Left by maks on Jun 29, 2007 5:20 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Need your code urgently.
Left by Junias on Aug 28, 2007 8:39 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Hi, Thanks a lot (*_*)
Left by Thank you on Sep 04, 2007 1:36 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
U can try this
char[] characters = System.Text.Encoding.ASCII.GetChars(new byte[] {65});
Left by Meetu on Sep 10, 2007 5:32 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...

Dear ,
Please send the code sample if u have it .

Thanks in advance
Left by Vinod on Sep 11, 2007 6:31 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Lol,

^ That IS the code!
Left by Luke on Nov 09, 2007 5:55 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
where is the code?????// I am too dumb to see it right there in the message!!!!1
Left by george on Dec 06, 2007 10:39 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
are you fuckin blind? the code is right there.
Left by dwadwa on Mar 18, 2008 1:48 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
That is nice to avail it over here,
Thank you very much
Left by Hasmukh Ghatala on Mar 25, 2008 5:31 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
your codes, may i has them
Left by lulz on Apr 12, 2008 7:01 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Wow... a lot of scriptkiddies (usually they are write-only)...... lol
Left by Hix on Jun 20, 2008 1:13 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
thanks sir

i am learning ASP.NET now & i know about oops concept

i was looking for this (getting unicode)!
now i want to khow that if we got a unicode of a particular character now i want to convert it into another language

like
"arabic , chinees ,hindi, french ".

means i want to use it as a global character !

is this possible ?

please help me !


Left by rahul singh on Aug 01, 2008 7:36 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
thanks sir

i want to get unicode of a particular character
Left by rahul singh on Aug 01, 2008 7:37 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
thanks again !
Left by rahul on Aug 01, 2008 7:39 PM

# want to convert unicode in another language
Requesting Gravatar...


show me the code for international applicatyion
Left by rahul_singh on Aug 29, 2008 7:10 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
YOu can use
Convert.ToChar(230)
Left by cosmic on Sep 12, 2008 10:31 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Thanks a lot for all .
Left by akbar on Oct 23, 2008 4:33 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
tooooooooooooo many stupid questions here lol
Left by hahaha on Nov 09, 2008 7:23 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Hahaha, where is the code :P LOL
Left by naing on Nov 13, 2008 6:26 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
where is the code yaar!!!!!!!!!!!!!!!!!
Left by raj on Feb 14, 2009 6:01 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Hi,
I Need to convert unicode.
I am blank now.
will u help me,
Left by shanthi on Apr 10, 2009 5:15 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
This is the worst thread!!!
everybody ask the same quesiton and NOBODY sayd where the code is!
I need this ASAP. unicode anyone?

also getting updatepanel in asp.net. how do that?
they say pages are faster with it!! I want it
Left by internetmilionnaire on Apr 11, 2009 10:42 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
WTF!

where's the code! LOL

is this a bellend convention? :-?
Left by amazedOnlooker on Apr 18, 2009 8:02 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
The code is right there:

cast the char to an int
Left by Shocked on May 01, 2009 3:17 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Looks like lot of folks are either
1) unable to see that the code is right there or
2) Lazy enough to implement the above logic in their software thinking that others can come to them or beg to get an opportunity to modify THEIR(the blind folks') code so the above-code-poster might try hard (to prove that it this code on this screen could also work for them) and automatically get THEIR(the blind folks') code included with the needed logic with out getting their hands dirty.

The silly strategy no-2 above is, unfortunately, the trait of many amateur programmers and discourages the nice idea and code-sharing people.

Buddies, please read the post clearly and atleast twice before posting requests for code.

Thanks

VC
Left by VC on Jul 05, 2009 12:52 PM

# re: How to convert ascii/unicode character to integer codes using C#.NET
Requesting Gravatar...
hi
I need a method or code to convert unicode character to integer and also unicode character to ascii character
thanks for help
Left by zahra torabi on Aug 07, 2009 11:53 PM

# How to convert Hindi font to unicode in asp.net c#
Requesting Gravatar...
Please solve this problem.
Left by Deepak on Sep 30, 2009 2:05 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
All of your code are belong to us!!!
Left by Wing on Oct 14, 2009 6:26 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
I need the code too asap, where is it??? Somewhere hidden in this page?

Victor
Left by Victor on Dec 08, 2009 11:55 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
I need all your code to sell to someone for lots of money please
Left by Hindi on Dec 14, 2009 7:40 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
I need to insert tamil words into database. and also retireve from that data base in asp web form with c#
Left by karthik on Jan 04, 2010 3:35 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
if you get answer that
you send the my e-mail id
Left by Altafhusain on Jan 06, 2010 2:12 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
you send answer my e-mail id
Left by Altafhusain on Jan 06, 2010 2:12 AM

# Stupid
Requesting Gravatar...
I am another blind person who wants to know where the code is :P

Left by Blind Person on Jan 19, 2010 2:40 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
For each character in the string this displays:

The character
It's unicode character code in hex
It's unicode character code number
string text = "0 a+…”";
foreach (char c in text)
{
Console.WriteLine("{0} U+{1:x4} {2}", c, (int)c, (int)c);
}

HTH

Tim
Left by a@gmail.com on Feb 08, 2010 3:10 AM

# how to get unicode character codes
Requesting Gravatar...
i don't know what u people are discussing and why u people are using foreach loop, i.e u r passing hexa decimal code to string and getting char by char is it give unicode?.
Left by shiva on Mar 09, 2010 1:03 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
this is hilarious, just goes to show that just because you have notepad, doesn't mean you know how to code... Thanks for the code by the way! ;-)
Left by j on Apr 17, 2010 11:57 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Could you email me the code?

(BTW, this is freakin hilarious) :-)
Left by Andy on Aug 25, 2010 10:29 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
i wanted to know how to use unicode in my website
Left by Ravi Potdar on Dec 03, 2010 12:02 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
how use f1 ascii in c#winform keypress event
Left by muhammed ali.k on Dec 13, 2010 1:45 AM

# re: How to get all ascii characters codes using C#.NET
Requesting Gravatar...
ascii characters codes using C#.NET
Left by mpld on Jan 04, 2011 2:51 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
dr["Req_id"] = dr["Req_id"].ToString() + "'U+0028'" + count1 + "'U+0029'";

dr["Req_id"]=1452
count1=6
i want to show it like 1452(6) in grid using datarow
Left by sushmitha on Feb 17, 2011 2:44 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
god, people's retarded
Left by juan on Feb 24, 2011 4:34 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Okay, I see the code, and Console.WriteLine("{0} U+{1:x4} {2}", c, (int)c, (int)c); does indeed output the information I was looking for. However, I'm unfamiliar with the way Console.WriteLine works, so I don't know how to apply any of the example arguments to a more generic code situation. Suppose I want to take the hex code of the character and assign it to a string variable to be looked up in a table, rather than simply outputting it to the debug window? Even though "The code is right there!" it will be necessary for me to continue combing the Internet for a more accessible explanation of what seems like it should be a simple operation. Ah, the woes of an amateur. -_-
Left by Violet on Apr 26, 2011 4:37 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
Thanks for the simple solution. Amazed that so many people are asking for the code. This thread made my day.
Left by wtfBBQ on May 31, 2011 12:50 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
I need to insert Telugu(Indian Language) words into database. and also retireve from that data base in asp web form with c#
Left by srvs on Aug 26, 2011 6:33 AM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
I want to just replace each char at time. Can you help me?
Left by Ana on Nov 10, 2011 4:11 PM

# re: How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
thanks boss
Left by maddhater on Jan 22, 2012 3:38 PM

# How to get ascii/unicode character codes using C#.NET
Requesting Gravatar...
It is good to have such service.i thankful to you
Left by Danoge on May 23, 2012 5:17 AM

Your comment:
 (will show your gravatar)


Copyright © Tim Huffam | Powered by: GeeksWithBlogs.net | Join free