1樓:懵是懵b的懵
將txt的編碼改為utf-8
2樓:匿名使用者
使用這個試試看
using (system.io.streamreader sr = new system.io.streamreader(filename, true))
3樓:妞妞如此生活
streamreader sr = file.opentext(filename);
改為streamreader sr = new streamreader(filename,encoding.default);
streamreader sr = new streamreader(filename, encoding.utf8);
主要utf8
c#讀取檔案到textbox時出現中文亂碼
4樓:匿名使用者
是編碼不匹配導致的亂碼。有兩種解決方法。
1)將文字檔案儲存為utf8編碼
這時,使用以下語句讀取文字檔案
// readalllines方法預設採用utf8編碼
string lines = file.readalllines(filepaht);
2)將文字檔案儲存為ansi編碼(這是windows文字檔案預設的編碼)
這時,使用以下語句
// 與ansi編碼對應的編碼為gb2312
string lines = file.readalllines(filepaht,
system.text.encoding.getencoding("gb2312"));
5樓:肚大好泡妞
你少加了編碼資訊,read方法可以加上編碼資訊
C讀取檔案的每行資料,c 讀取pdf檔案裡面資料!!
用fgets讀入一行,用sscanf 讀出第一列資料下面假定第一列資料作為字串,用 sscanf buf,s 格式讀。類似,整型用 d 浮點用 f lf include include main return 0 如果要讀每行第一個數,只讀一位數 用 格式 1d int x 100 while fg...
C中如何將SQL資料庫中讀取到的一整行資料存到陣列,最好是list中,請寫詳細答案
輸入框一般都是textbox,命名使用者名稱輸入框為textbox1密碼為textbox2 select from 表名 where 欄位名 textbox1.text 一般都是用sqldatareader dr去讀取,如果讀取到了說明這個使用者名稱存在,那麼在判斷密碼欄位dr pwd tostri...
c語言讀取檔案的路徑怎麼設定,C語言中寫檔案如何改變檔案存放的位置?
student.dat 或者直接設定它的路徑,比如在c盤windows下就是 c windows student.dat 注意要多加 也就是說是 c語言中寫檔案如何改變檔案存放的位置?file f fopen d project1 data test.dat w 注意斜槓轉義字元就行了 你先強制轉換...