前提
vscode上でkotlinのコードを実行すると日本語部分が文字化けします。(実行方法は「Run Code」。実行結果の表示場所は「出力」です)
実現したいこと
文字化けを無くして、日本語を正しく表示させたい。
発生している問題・エラーメッセージ
(表示結果)
����ɂ��́A���E!
該当のソースコード
kotlin
1fun main() { 2 val message : String = "こんにちは、世界!" 3 println(message) 4}
試したこと
1.設定>拡張機能>Run Code configuration>「Run In Terminal」にチェックを入れて表示場所をターミナルに変更してみましたが、解決しませんでした。
2.「setting.json」の末尾に下記コードを追加してみましたが、変化ありませんでした。(その後、削除)
,
“terminal.integrated.shellArgs.windows”: [
“-NoExit”,
“chcp”,
“65001”
]
※上記を試した後、表示場所を「出力」に戻しました。
補足情報(FW/ツールのバージョンなど)
kotlin 1.7.20
Visual Studio Code 1.72.2
*拡張機能「Kotlin」「Kotlin Language」「Code Runner」インストール済み
Windows 11
*unicide対応でないプログラムの言語 日本語
*「ベータ:ワールドワイド言語サポートでUnicode UTF-8を使用」チェック済み
Visual Studio Codeの
【settings.json】
{
"window.zoomLevel": 1,
"liveServer.settings.CustomBrowser": "chrome",
"atomKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true,
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"liveServer.settings.donotShowInfoMsg": true,
"[javascript]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"workbench.editor.enablePreview": false,
// "php.validate.executablePath": "C:\xampp\php\php.exe",
"php.validate.executablePath": "C:\Users\***\Desktop\pleiades\xampp\php\php.exe",
"editor.formatOnSave": true,
"workbench.iconTheme": "vscode-icons",
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"vsicons.dontShowNewVersionMessage": true,
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.insertSpaces": false,
"editor.fontFamily": "Ricty Diminished",
"files.autoSave": "afterDelay",
"editor.renderWhitespace": "all",
"emmet.variables": {
"lang": "ja"
},
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": null
}
],
"files.associations": {
".scss": "scss"
},
"liveSassCompile.settings.autoprefix": ["> 1%", "last 2 versions"],
"[scss]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"code-runner.executorMap": {
"kotlin": "cd $dir && kotlinc-jvm $fileName -include-runtime -d $fileNameWithoutExt.jar && java -jar $fileNameWithoutExt.jar"
},
"emmet.triggerExpansionOnTab": true,
"emmet.showSuggestionsAsSnippets": true,
"liveSassCompile.settings.generateMap": true,
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}

あなたの回答
tips
プレビュー