[問題] 關於UTF8格式的字串?

看板C_and_CPP (C/C++)作者 (千里之外)時間12年前 (2013/07/18 19:18), 編輯推噓0(003)
留言3則, 2人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VC2008 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 用unsigned char text[] 存下的data,是UTF8格式的字串,請問如何將這 text轉成String^ 的型態,想要印在應用程式的表單上。 餵入的資料(Input): 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): 程式碼(Code):(請善用置底文網頁, 記得排版) 補充說明(Supplement): 我是先將unsigned char text轉成 wchar_t[] text2的型態存放, 再用String str = gcnew String(text2)的方式。 但str印出的結果並不正確,請問各位大大有人可以幫我解惑嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.147.154.206

07/18 19:48, , 1F
轉wchar_t有用WideCharToMultibyte?
07/18 19:48, 1F

07/18 19:50, , 2F
不然就用Encoding::UTF8::GetString()
07/18 19:50, 2F

07/18 20:14, , 3F
謝謝樓上大大...
07/18 20:14, 3F
文章代碼(AID): #1HvyxkS_ (C_and_CPP)
文章代碼(AID): #1HvyxkS_ (C_and_CPP)