看板 C_and_CPP 關於我們 聯絡資訊
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) codeBlocks 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) string.h 問題(Question): 我想把鍵盤上的英文字跟注音作對應再轉換出來 例如:c8 xji -->哈囉 但是我發現把注音存進char陣列後會變亂碼 想問問這要怎麼解決或是關鍵字怎麼下? 餵入的資料(Input): c8 xji su3 cl3 預期的正確結果(Expected Output): 哈囉你好的注音 錯誤結果(Wrong Output): 程式碼(Code):(請善用置底文網頁, 記得排版) https://gist.github.com/Henry0526/b00e373f0004eac6948eb72340bc1608 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.43.65.243 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1472478559.A.D78.html
Caesar08: 沒有code? 08/29 21:56
pttworld: utf8 big5 keycode byte ascii 08/29 22:43
pttworld: input method table 08/29 22:43
CoNsTaR: wchar locale 08/30 00:01
昨天忘記貼程式碼抱歉! 我會去查查看上面的關鍵字的!! ※ 編輯: HenryLiKing (114.43.65.243), 08/30/2016 12:38:40
Caesar08: 注音符號是不能直接存在char裡面的 08/30 13:26
Caesar08: 編碼方式看你是要用utf系列或是big5 個人建議用utf8 08/30 13:29
Caesar08: 另外還要考慮terminal的locale,像是windows的cmd是big5 08/30 13:29
Caesar08: 如果你用utf8,到時候還要再轉一次 08/30 13:30
Caesar08: (或是你把cmd的code page改成utf8) 08/30 13:31