How to write "Ni Hao" ("Hello") in Chinese to standard output using UTF-8 in C#

1 Answer

0 votes
using System;
using System.Text;

class Program
{
    static void Main()
    {
        // Set the console output encoding to UTF-8
        Console.OutputEncoding = Encoding.UTF8;

        // Print "你好" to the console
        Console.WriteLine("你好");
    }
}



/*
run:
 
你好
 
*/

 



answered Aug 14, 2025 by avibootz
...