I convert string(UTF-8) to char array (in C#). and show on char array to Console, But it can not show UTF-8 Char in Console. how can i resolve this problem?
I use IDE Visual studio 2015 for C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace array
{
class Program
{
#region Convert String to char array
static void stringtochar()
{
string str0;
Console.OutputEncoding = Encoding.UTF8;
Console.Write("Nhập Chuỗi Ký Tự :");
str0 = Console.ReadLine();
Char[] str_arr = new Char[100]; // Create array
Array.Copy(str0.ToCharArray(), str_arr,str0.Length);
for (int i = 0; i < str0.Length; i++) {
Console.Write("[{0}] => \"{1}\"", i, str_arr[i]); }
Console.ReadLine();
}
#endregion
static void Main(string[] args)
{
stringtochar();
}
}
}
Nhập Chuỗi Ký Tự :đi chơi [0] => "d"[1] => "i"[2] => " "[3] => "c"[4] => "h"[5] => "o"[6] => "i"
i expect output to be [0] => "đ"