Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75628

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; '"""': 0.07; 'error:': 0.07; '(those': 0.09; '8bit%:30': 0.09; 'encode': 0.09; 'filenames': 0.09; 'idea?': 0.09; 'lawrence': 0.09; 'polish': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:characters': 0.09; 'python': 0.11; 'bug': 0.12; 'language.': 0.14; 'windows': 0.15; ';-)).': 0.16; 'codec': 0.16; 'means.': 0.16; 'menu.': 0.16; 'program?': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'rewritten': 0.16; 'subject:Unicode': 0.16; 'symbols': 0.16; 'unicode.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'command': 0.22; 'programming': 0.22; 'print': 0.22; 'header :User-Agent:1': 0.23; '(by': 0.24; 'subject:problem': 0.24; 'unicode': 0.24; 'skip:" 30': 0.26; 'this:': 0.26; '(for': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'idea': 0.28; 'character': 0.29; "doesn't": 0.30; 'characters': 0.30; "i'm": 0.30; 'code': 0.31; 'lines': 0.31; 'too.': 0.31; 'subject:some': 0.31; 'up:': 0.31; 'file': 0.32; '(most': 0.33; 'entirely': 0.33; 'subject:with': 0.35; "can't": 0.35; 'display': 0.35; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'version': 0.36; 'really': 0.36; '14,': 0.36; 'set.': 0.36; 'version:': 0.36; 'next': 0.36; 'possible': 0.36; 'hi,': 0.36; 'changing': 0.37; 'turn': 0.37; 'being': 0.38; 'problems': 0.38; 'work?': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'does': 0.39; 'help,': 0.39; 'support,': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'letters': 0.60; 'skip:c 50': 0.60; 'most': 0.60; 'matter': 0.61; 'our': 0.64; 'bottom': 0.67; 'believe': 0.68; 'production': 0.68; 'containing': 0.69; 'url:v': 0.71; 'url:youtube': 0.71; '8bit%:100': 0.72; 'construction': 0.72; 'url:watch': 0.77; 'characters,': 0.84; 'exercise,': 0.84; 'fonts': 0.84; 'messed': 0.84; 'them)': 0.84; '\xe2\x94\x82': 0.84; 'skip:\xe2 30': 0.91; 'skip:\xe2 40': 0.91; 'thing,': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: cmd.exe on WIndows - problem with displaying some Unicode characters
Date Mon, 04 Aug 2014 00:20:53 +0100
References <yxht7c4so8ud.kqpa5p5iv0mp.dlg@40tude.net>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host host-92-24-217-238.ppp.as43234.net
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0
In-Reply-To <yxht7c4so8ud.kqpa5p5iv0mp.dlg@40tude.net>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12602.1407108065.18130.python-list@python.org> (permalink)
Lines 81
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1407108065 news.xs4all.nl 2831 [2001:888:2000:d::a6]:45659
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:75628

Show key headers only | View raw


On 03/08/2014 23:52, Wiktor wrote:
>
> Hi,
>
> as OO programming exercise, I'm trying to port to Python one of my favorite
> game from early'90 (Atari 65XL/XE) - Kolony (here's video from original
> version on C64 https://www.youtube.com/watch?v=UFycYOp2cbE, and here's
> video from modern rewritten (for Atari emulators) version: Kolony 2106
> https://www.youtube.com/watch?v=eX20Qqqm5eg - you get the idea? ;-)).
>
> OO Design is one thing, but I want to make it look as near as possible to
> the original (those windows-like menus in console window). I tried to use
> 'standard' Unicode characters (I can see that most of my Windows monospaced
> fonts have them) to draw frame around menu. Something like this:
>
>   ┌──────────────╖
>   │ Construction ║
>   │ Production   ║
>   │ Research     ║
>   │ Exploration  ║
>   ├··············╢
>   │ Next turn    ║
>   ╘══════════════╝
>
> (I like the look of double lines on right and at the bottom)
> But when I try to print those characters, I get an error:
>
> | Traceback (most recent call last):
> |   File "E:\Moje dokumenty\python\kolony\menu.py", line 14, in <module>
> |     """
> |   File "C:\Python34\lib\encodings\cp852.py", line 19, in encode
> |     return codecs.charmap_encode(input,self.errors,encoding_map)[0]
> | UnicodeEncodeError: 'charmap' codec can't encode character '\u2556' in position 1
> | 6: character maps to <undefined>
>
> Now I know what that means. Code page that my cmd.exe is using (852)
> doesn't have "╖", "╘", "╢" and "·" symbols. Changing code page to Unicode
> (65001) doesn't really help, because all is messed up:
>   ┌──────────────╖
>   │ Construction ║
>   │ Production   ║
>   │ Research     ║
>   │ Exploration  ║
>   ├··············╢
>   │ Next turn    ║
>   ╘══════════════╝
>      �·········╢
>   │ Next turn    ║
>   ╘══════════════╝
>      ��════════════╝
>      ��═════╝
>      ═╝
> (I believe that's cmd.exe bug with Unicode support, not Python fault)
>
>
> Before I drop entirely this idea of using double lines on right and bottom
> edges, and make it look like this
>      ┌──────────────┐
>      │ Construction │
>      ├--------------┤
>      │ Next turn    │
>      └──────────────┘
> I have to ask - is there a way to make that original concept work? I know,
> that CP437 has symbols "╖", "╢" and "╘", but does not have polish letters -
> and I need to display them too.
> I also know, that cmd.exe can display those Unicode characters (by
> copy/paste them in command line or by listing filenames containing that
> characters), no matter what CP is set. How does it manage to do it? Can I
> exploit that writing my Python program?
> Wiktor
>

There are multiple known problems with cmd.exe and unicode.  A solution 
might be to use powershell, but windows being windows who really knows? :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-04 00:52 +0200
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris Angelico <rosuav@gmail.com> - 2014-08-04 09:08 +1000
    Re: cmd.exe on WIndows - problem with displaying some Unicode characters Christian Gollwitzer <auriocus@gmx.de> - 2014-08-04 22:35 +0200
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-04 00:20 +0100
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Andrew Berg <aberg010@my.hennepintech.edu> - 2014-08-03 18:25 -0500
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-04 00:29 +0100
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris Angelico <rosuav@gmail.com> - 2014-08-04 09:39 +1000
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris Angelico <rosuav@gmail.com> - 2014-08-04 10:14 +1000
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-03 17:17 -0700
    Re: cmd.exe on WIndows - problem with displaying some Unicode characters wxjmfauth@gmail.com - 2014-08-04 01:47 -0700
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-03 21:14 -0700
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Andrew Berg <aberg010@my.hennepintech.edu> - 2014-08-04 00:06 -0500
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Terry Reedy <tjreedy@udel.edu> - 2014-08-04 04:39 -0400
    Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-04 17:00 +0200
      Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-08-04 17:43 +0200
        Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-04 18:48 +0200
          Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris Angelico <rosuav@gmail.com> - 2014-08-05 03:06 +1000
            Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-04 19:22 +0200
              Re: cmd.exe on WIndows - problem with displaying some Unicode characters Terry Reedy <tjreedy@udel.edu> - 2014-08-04 15:43 -0400
      Re: cmd.exe on WIndows - problem with displaying some Unicode characters Terry Reedy <tjreedy@udel.edu> - 2014-08-04 15:17 -0400
        Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-04 22:24 +0200
          Re: cmd.exe on WIndows - problem with displaying some Unicode characters Akira Li <4kir4.1i@gmail.com> - 2014-08-05 04:51 +0400
            Re: cmd.exe on WIndows - problem with displaying some Unicode characters wxjmfauth@gmail.com - 2014-08-05 00:38 -0700
            Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-05 11:39 +0200
      Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris Angelico <rosuav@gmail.com> - 2014-08-05 06:11 +1000
      Re: cmd.exe on WIndows - problem with displaying some Unicode characters giacomo boffi <g@boffi.net> - 2014-08-04 22:53 +0200
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-08-04 10:46 +0200
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-04 02:46 -0700
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-04 02:53 -0700
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-08-04 12:24 +0200
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Andrew Berg <aberg010@my.hennepintech.edu> - 2014-08-04 05:33 -0500
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-04 11:04 -0700
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-04 11:15 -0700
    Re: cmd.exe on WIndows - problem with displaying some Unicode characters Grant Edwards <invalid@invalid.invalid> - 2014-08-04 19:30 +0000
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Terry Reedy <tjreedy@udel.edu> - 2014-08-04 15:25 -0400
  Re: cmd.exe on WIndows - problem with displaying some Unicode characters Tony the Tiger <tony@tiger.invalid> - 2014-08-05 20:26 +0000
    Re: cmd.exe on WIndows - problem with displaying some Unicode characters Grant Edwards <invalid@invalid.invalid> - 2014-08-05 20:41 +0000
    Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-06 00:16 +0200
      Re: cmd.exe on WIndows - problem with displaying some Unicode characters Tony the Tiger <tony@tiger.invalid> - 2014-08-06 18:27 +0000
    Re: cmd.exe on WIndows - problem with displaying some Unicode characters wxjmfauth@gmail.com - 2014-08-05 23:30 -0700

csiph-web