Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6696963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:24:12+00:00 2026-05-26T06:24:12+00:00

byte[] tagData = GetTagBytes(tagID, out tiffDataType, out numberOfComponents); string str = Encoding.ASCII.GetString(tagData); With windows

  • 0
byte[] tagData = GetTagBytes(tagID, out tiffDataType, out numberOfComponents);
string str = Encoding.ASCII.GetString(tagData);

With windows phone platform, the framework doesn’t support Encoding.ASCII.GetString() method.

I used to get help from Passant’s post ASCIIEncoding In Windows Phone 7 befroe. But it only convert string to byte[], now I need to convert byte[] into string.

Any Help would be nice~

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:24:13+00:00Added an answer on May 26, 2026 at 6:24 am

    If you try to understand how Hans’ code works, you’ll easily come up with the reverse conversion:

    public static string AsciiToString(byte[] bytes) { 
            StringBuilder sb = new StringBuilder(bytes.Length); 
            foreach(byte b in bytes) {
                sb.Append(b<=0x7f ? (char)b : '?'); 
            } 
            return sb.ToString(); 
        } 
    

    You can also use LINQ but a nice solution is available only on .NET 4.0:

    string AsciiToString(byte[] bytes)
    {
      return string.Concat( bytes.Select(b => b <= 0x7f ? (char)b : '?') );
    }
    

    The unfortunate lack of the String.Concat<T>(IEnumerable<T>) overload in former versions of the framework forces you to use the somewhat ugly and inefficient:

    string AsciiToString(byte[] bytes)
    {
      return string.Concat( 
        ( bytes.Select(b => (b <= 0x7f ? (char)b : '?').ToString()) )
        .ToArray()
        );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

byte[] header = new byte[]{255, 216}; string ascii = Encoding.ASCII.GetString(header); I expect ASCII to
Suppose I have a Byte array and I use Encoding.ASCII.GetString() to convert the bytes
byte[] bytes = new byte[] { 1, -1 }; System.out.println(Arrays.toString(new String(bytes, UTF-8).getBytes(UTF-8))); System.out.println(Arrays.toString(new String(bytes,
foreach (byte binaryOutupt in Encoding.ASCII.GetBytes(fileLine)) { fileOutput.Write(binaryOutupt.ToString(x2)); } I got this code which let
I have byte[] a = HashEncrypt(a); with public byte[] HashEncrypt(string password) { SHA512Managed sha
It is written byte[][] getImagesForFields(java.lang.String[] fieldnames) Gets an array of images for the given
final byte LOGIN_REQUEST = 1; long deviceId = 123456789; String nickname = testid; Socket
byte[] bytes = new byte[uploader.UploadedFiles[0].InputStream.Length]; uploader.UploadedFiles[0].InputStream.Read(bytes, 0, bytes.Length); var storedFile = new document(); string
given that a n-byte array can be represented as a 2*n character string using
byte[] data = (byte[])opBinding.execute(); PrintWriter out = new PrintWriter(outputStream); out.println(data); out.flush(); out.close(); but instead

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.