stream| Code | problem
Problem Description:
WIN2000SP4 Chinese, vs2005 English, oracle9i.
In the program, there is a RichTextBox, to display the SQL statements of the database, use StreamWriter () to write the contents of RichTextBox into a text file, but if the SQL statement contains Chinese, there will be garbled.
Reason for error:
- Constructor StreamWriter (String), by default, UTF-8 encoding to create the StreamWriter, so there is garbled.
Solution:
- The constructor StreamWriter (string,encoding) can specify the appropriate encoding.
StreamWriter sw = new StreamWriter (Filename,false, System.Text.Encoding.Default); (Problem solving)
System.Text.Encoding.Default This value is related to the setup of the operating system, which is related to the locale of the control Panel and the language option, similar to the Oracle character set.