看板 C_Sharp 關於我們 聯絡資訊
以下是小弟的程式 ======================== WshShellClass myWshShell; // Create a new instance of WshShellClass myWshShell = new WshShellClass(); // Create the shortcut IWshRuntimeLibrary.IWshShortcut MyShortcut; // Choose the path for the shortcut MyShortcut = (IWshRuntimeLibrary.IWshShortcut)myWshShell.CreateShortcut(name + ".lnk"); // Where the shortcut should point to MyShortcut.TargetPath = filePath; // Create the shortcut at the given path MyShortcut.Save(); ======================= 就是FilePath的地方沒有辦法接受簡體字或日文 有沒有什麼方法可以讓他變成Unicode呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.195.147.70
pico2k:MyShortcut.TargetPath = @"..."; 01/17 23:18
senjor:是變數,樓上這樣好像沒辦法套用到變數。 01/17 23:21
wvsrugby:xxx.TargetPath = """"+filePath+""""; //這樣可嗎? 01/18 02:19
senjor:不行 XD 01/18 10:55
bdvstg:印象中... C#中 字串(string或char)預設全都是Unicode... 01/18 16:03
bdvstg:然而XP的檔案系統好像是走big5的編碼(所以簡中日文出問) 01/18 16:05
bdvstg:建議裝Unicode補完計畫試試看... 01/18 16:06
bdvstg:順帶一問.. 你系統裡的檔案用日文命名後 看起來正常嗎? 01/18 16:09
dna2me:試試看UTF8Encoding這個類別 01/18 16:18
dna2me:或是Encoding類別 01/18 16:30
pico2k:google "c# unicode string" 01/18 17:35
senjor:系統裡的日文跟簡中是正常顯示的,而且也可以製作捷徑 01/18 22:36
senjor:但是只要一用到這個類別就沒辦法接受Unicode 01/18 22:37
senjor:我的input都是unicode的了,但是放進去之後就會變成BIG5。 01/18 22:41
senjor:不知道有沒有大大有遇過類似的問題? 01/18 22:41
senjor:還是說要用其它製作捷徑的方式? 01/18 22:41
bdvstg:我放棄... 不知為啥指派給TargetPath的 都強制被改為big5.. 01/19 07:34
senjor:我也放棄,就當這一題無解吧! XDDD 01/19 10:21