Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!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; 'escape': 0.04; '3.2': 0.05; 'char': 0.07; 'python': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'output': 0.11; 'wrote:': 0.14; 'received:dip.t-dialin.net': 0.16; 'received:t-dialin.net': 0.16; 'running:': 0.16; 'sequence,': 0.16; 'happening': 0.19; 'interpreted': 0.23; 'seeing': 0.28; 'skip:p 30': 0.28; 'ansi': 0.30; 'from:addr:web.de': 0.30; 'header:X-Complaints-To:1': 0.32; 'to:addr:python-list': 0.33; 'actually': 0.33; "isn't": 0.33; 'characters': 0.34; 'there': 0.35; 'skip:" 10': 0.35; 'using': 0.35; 'subject:text': 0.36; 'http': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'header:Mime-Version:1': 0.39; 'goes': 0.39; 'to:addr:python.org': 0.39; 'format': 0.40; 'bold': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Unescaping formatted Terminal text Date: Fri, 03 Jun 2011 17:15:09 +0200 Organization: None References: <1d3cc5b2-39c1-4bb8-a692-ff166533dbca@y12g2000yqh.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p50849488.dip.t-dialin.net X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 25 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1307114122 news.xs4all.nl 49174 [::ffff:82.94.164.166]:49003 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6951 Gnarlodious wrote: > This may be happening because I am using Python 3.2 which includes > "curses" to format output. When running: > > pydoc.render_doc(sys.modules[__name__]) > > in Terminal I see FUNCTIONS > > when the same output goes to HTTP I see FFUUNNCCTTIIOONNSS What you are seeing isn't an ANSI escape sequence, it's actually Char- Backspace-Char (e. g. "F\bF\U\bU...") which is interpreted as a bold Char by the "less" utility. > Is there an easy way to strip ANSI escaped characters from output for > CGI rendering? pydoc.render_doc(module, renderer=pydoc.plaintext) or even pydoc.render_doc(module, renderer=pydoc.html)