回答編集履歴

1

日本語文字化け対策を追加

2017/07/06 02:48

投稿

can110
can110

スコア38266

test CHANGED
@@ -5,8 +5,6 @@
5
5
 
6
6
 
7
7
  以下はpythonでの例です。
8
-
9
- ただし、こちらの環境(RaspPi2にTeraTermでSSH接続)では日本語を表示すると文字化けしてしまいます。
10
8
 
11
9
  ```Python
12
10
 
@@ -26,6 +24,16 @@
26
24
 
27
25
 
28
26
 
27
+ # addstrでの文字化け対策
28
+
29
+ # http://d.hatena.ne.jp/SumiTomohiko/20070518/1179499889
30
+
31
+ import locale
32
+
33
+ locale.setlocale(locale.LC_ALL, "")
34
+
35
+
36
+
29
37
  def main(stdscr):
30
38
 
31
39
  stdscr.clear()
@@ -36,7 +44,7 @@
36
44
 
37
45
 
38
46
 
39
- stdscr.addstr( 0, 0, 'press any key to end.', curses.A_BOLD)
47
+ stdscr.addstr( 0, 0, 'キー入力で終了', curses.A_BOLD)
40
48
 
41
49
  x = 0
42
50