First, the source code is to be saved in UTF8 format, then compile the option: MCS -CODEPAGE: UTF8
Note: The notebook comes with Windows can be saved as a UTF8 format.
Code example:
// Monocn.cs
Using system.windows.forms;
Public class myform: form {button btn = new button (); public myform () {btn.text = "Chinese button"; btn.click = new system.eventhandler (this.btn_clicked); this.controls.add (btn }
Private void btn_clicked (System.Object O, System.EventArgs E) {MessageBox.show ("Hello!");
Static void main () {application.run (new myform ());}}
The above code is saved to UTF8 format with Windows Notepad.
Open the MONO command prompt (start, program, mono 1.1.4 for windows, mono-1.1.4 command prompt):
MCS -T: Winexe -r: system.windows.forms.dll -out: d: /monocn.exe -codepage: UTF8 (local file path) Monocn.cs
Go to D disk and try it.