I asked here , but I’m sure I won’t get an answer.
- copy - paste this python code:
- execute it
- in the classic utf8 shell it works correctly and displays "Coordinates", but in my mintty terminal at home it displays "CoordonnM-CM-) es". Any idea how I can make it work, or where should I look (mintty has no character encoding options)?
the code:
import os, sys, time, random, copy, pprint
import termios, tty, fcntl
import thread, curses
import locale
def curses_main(stdscr, code):
curses.curs_set(0)
stdscr.addstr(2, 0, "Coordonnées")
stdscr.refresh()
curses.halfdelay(1)
while True:
try:
c=stdscr.getch()
except:
c=-1
if 0<c<256:
if chr(c) in 'Qq':
break
def main():
locale.setlocale(locale.LC_ALL, '')
code = locale.getpreferredencoding()
curses.wrapper(curses_main, code)
if __name__ == '__main__':
main()
Update
Error: I thought I found this: it is written everywhere to start with this code:
locale.setlocale(locale.LC_ALL, '')
so I tried with this and worked:
locale.setlocale(locale.LC_ALL, 'fr_FR')
=> forced in french
... he worked, but only for emphasis. If I try to print lines of line drawings:
stdscr.addstr(20,20, "─ │ ┌ ┘ ┐ └ ├ ┤ ┬ ┴ ┼ ═ ║ ╔ ╝ ╗ ╚ ╠ ╣ ╦ ╩ ╬")
gives me:
M-b~T~@ M-b~T~B M-b~T~L M-b~T~X M-...
, , vim . , ... python?
Windows/cygwin/mintty, :
env | grep -i lang
LANG=C.UTF-8
Windows/cygwin/mintty, :
locale.setlocale(locale.LC_ALL, 'C.UTF-8')
.
, ? python, , ... , , vim. , , , ...