Nessesarius / mintty

Automatically exported from code.google.com/p/mintty
GNU General Public License v3.0
0 stars 0 forks source link

python curses / utf8 / international chars problem #248

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. copy - paste this python code :

 1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3
  4 import os, sys, time, random, copy, pprint
  5 import termios, tty, fcntl
  6 import thread, curses
  7 import locale
  8
  9 def curses_main(stdscr, code):
 10     curses.curs_set(0)
 11     stdscr.addstr(2, 0, "Coordonnées")
 12     stdscr.refresh()
 13     # (1) = délai d'attente de 1/10 ème de seconde :
 14     curses.halfdelay(1)
 15     while True:
 16         try:
 17             c=stdscr.getch()
 18         except:
 19             c=-1
 20         if 0<c<256:
 21             if chr(c) in 'Qq':
 22                 break
 23
 24 def main():
 25     locale.setlocale(locale.LC_ALL, '')
 26     code = locale.getpreferredencoding()
 27     curses.wrapper(curses_main, code)
 28
 29 # Lorsque le script est exécuté, appeler la fonction principale :
 30 if __name__ == '__main__':
 31     main()
 32

2. execute it 
3. it works in all ssh, and a version of mintty at my work : it writes 
"Coordonnées", but not here on my own pc at home : it prints "

What is the expected output?
- Coordonnées

What do you see instead?
- CoordonnM-CM-)es

What versions of mintty, Cygwin/MSYS, and Windows are you using?
Windows XP 64 / Mintty 0.9.5

Please provide any additional information below.
It works in all ssh, and a version of mintty at my work : it writes 
"Coordonnées", but not here on my own pc at home : it prints "CoordonnM-CM-)es"

Original issue reported on code.google.com by olivier....@gmail.com on 23 Jan 2011 at 10:34

GoogleCodeExporter commented 8 years ago
I don't think that's a defect report, but a request for help, which is best 
sent to the mintty discussion group or Cygwin mailing list. But I see you 
already asked this at 
http://stackoverflow.com/questions/4780591/mintty-terminal-python-curses-and-utf
8-incorrect-display anyway.

Original comment by andy.koppe on 25 Jan 2011 at 5:50

GoogleCodeExporter commented 8 years ago
This is not a defect you're right, and I'm sorry about this, I've not described 
in details but I've worked yesterday more than 8 hours without finding why it 
works properly on my 4 machines :
- shell Linux Ubuntu,
- shell ssh with putty under Windows XP
- shell mintty using cygwin under Windows XP

and what annoys me is that is doesn't work at home :
- shell mintty using cygwin under Windows Vista 64
If I modify this line of code :
locale.setlocale(locale.LC_ALL, '')
by  

locale.setlocale(locale.LC_ALL, 'fr_FR')
it displays properly the French chars but *not* all other chars.
I'm definitely stuck.
See my post here:

http://stackoverflow.com/questions/4780591/mintty-terminal-python-curses-and-utf
8-incorrect-display/4787176#4787176

Original comment by olivier....@gmail.com on 25 Jan 2011 at 9:47

GoogleCodeExporter commented 8 years ago
It's solved. here's what I did: I re-installed cygwin then repacked my python 
program a re-downloaded it then re-installed minnty 0.9.5.1 
(mintty-0.9.5-cygwin17.zip) and it works now. Strange.

Original comment by olivier....@gmail.com on 25 Jan 2011 at 9:04