0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

新しい visual studio 2026 を使用して python で日本語コメントありの状態で走らせると文字化けするしエラーがでる場合のTips

0
Posted at

TL;DR

 コードが書いてあるウィンドウの右下にある、おそらく「Shift JIS」と書かれているものをクリックし、「エンコード付きで保存」、(おすすめは)「Unicode (UTF-8 署名付き)- コードページ 65001」を選択して「OK」押す。そして実行。

小話

 初心者なので許してください。自分の備忘録用にも書いています。何かございましたらマサカリをよろしくお願いいたします。

まずは実例

image.png
 こんな感じで適当に作ったPython アプリケーション(Pythonであれば多分大丈夫。)
で

# こんにちは
print("Hello, World!")

 このような簡単なスクリプトを作成し、実行すると、
image.png
 このように文字化けしてエラーが出る場合がある。

どうすればいいのか

image.png
例えばここの。右下にある。
image.png
の「Shift JIS」という場所をクリックし、「エンコード付きで保存」を選択、(おすすめは)「Unicode (UTF-8 署名付き)- コードページ 65001」を選択し、「OK」を押すと実行できる。

以上

終わりに

 とくに、エンコード形式については半ば直感で選んでいるので、何かもっといい案があれば教えてもらえればありがたい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?