Click here to Skip to main content
15,892,804 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai Friends

How to get a charactor from an ascii value, i tried this code, but when iam passed more than 128 ascii value it return '?' .How to convert it? is there is any other method to do this ? please help me..


C#
public string GetString(byte ascValue)
       {
           ASCIIEncoding ascii = new ASCIIEncoding();
           byte[] asc = new byte[1];
           asc[0] = ascValue;
           string str = ascii.GetString(asc);
           return str;
       }
Posted

Hi,
Use Chr Function. Following is an Example-
Chr(120) Returns x.
Or
C#
MessageBox.Show(Chr(120));
 
Share this answer
 
It's because of the WindowsCodePage property (set by the OS) in the encoder. I think you might want to use the UTF8Encoding object instead.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900