How to convert UTF-8 byte array to string in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        byte[] bytes = { 97, 98, 99, 100 };

        string s = System.Text.Encoding.UTF8.GetString(bytes);

        Console.WriteLine(s);
    }
}




/*
run:

abcd

*/

 



answered Jun 11, 2021 by avibootz

Related questions

...