Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; '(at': 0.04; 'output': 0.05; 'calls.': 0.09; 'escape': 0.09; 'formatting': 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; 'windows,': 0.09; 'wrapper': 0.09; 'yeah,': 0.09; 'translate': 0.10; 'api': 0.11; 'jan': 0.12; 'translation': 0.12; 'clear.': 0.16; 'function"': 0.16; 'itself,': 0.16; 'of)': 0.16; 'outputs': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'reversed': 0.16; 'stdout': 0.16; 'subject:Unicode': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'meant': 0.20; 'seems': 0.21; 'command': 0.22; '>>>': 0.22; 'code,': 0.22; 'aug': 0.22; 'header:User-Agent:1': 0.23; 'adds': 0.24; 'subject:problem': 0.24; 'text.': 0.24; 'fine': 0.24; 'source': 0.25; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'properties': 0.29; "doesn't": 0.30; 'characters': 0.30; 'needed.': 0.30; 'work.': 0.31; '(used': 0.31; 'omitted': 0.31; 'subject:some': 0.31; 'this.': 0.32; 'linux': 0.33; 'says': 0.33; 'url:python': 0.33; 'guess': 0.33; 'screen': 0.34; 'maybe': 0.34; 'subject:with': 0.35; 'but': 0.35; 'described': 0.36; "didn't": 0.36; 'url:org': 0.36; 'so,': 0.37; 'depends': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'little': 0.38; 'anything': 0.39; "couldn't": 0.39; 'received:71': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'above,': 0.60; 'color': 0.61; 'back': 0.62; 'url:0': 0.67; '"just': 0.84; 'alone,': 0.84; 'received:fios.verizon.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: cmd.exe on WIndows - problem with displaying some Unicode characters Date: Mon, 04 Aug 2014 15:43:49 -0400 References: <1hdz57o67rhxx$.198mzdgo1ztk8.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-71-175-90-87.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407181457 news.xs4all.nl 2926 [2001:888:2000:d::a6]:33812 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75707 On 8/4/2014 1:22 PM, Wiktor wrote: > On Tue, 5 Aug 2014 03:06:41 +1000, Chris Angelico wrote: > >> On Tue, Aug 5, 2014 at 2:48 AM, Wiktor wrote: >>> From colorama I just use one function - init(). Without this >>> initialization all those ansii escape characters (used by colorama itself, >>> but also by termcolor.colored()) don't work in cmd.exe. At least I couldn't >>> make it work. >> >> I dug into colorama's source code, and it seems that "just one >> function" is a little dismissive :) When you call colorama's init(), >> it replaces stdout with a wrapper that parses ANSI sequences and turns >> them into API calls. So, yeah, without that anything that outputs ANSI >> sequences isn't going to work. > > Maybe I didn't write it clear. :-) What I meant was, that even though I > don't use any other functions from colorama (I color all the strings with > termcolor) - I still have to use init() function from colorama. > termcolor doesn't want to work alone, even though its described as OS > independent. Termcolor says "ANSI Color formatting for output in terminal." https://pypi.python.org/pypi/termcolor/1.1.0 It is OS-independent but depends on support of standard ANSI screen command codes. Microsoft removed that support from cmd.exe. If you look at the Terminal properties box on the page above, the only thing termcolor can do on Windows, by itself, is reversed text. Colorama.init adds back (at least some of) the ANSI to API translation omitted from cmd.exe. > I guess it works fine on Linux terminal without init() Because linux terminals translate ANSI to whatever api calls are needed. > function from colorama. In cmd.exe I need colorama just for this. -- Terry Jan Reedy