Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!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.023 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'retrieved': 0.05; 'try:': 0.07; 'python': 0.09; 'url:%s': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'encoding': 0.15; 'file,': 0.15; 'printing.': 0.16; 'subject:Unicode': 0.16; 'url:mi': 0.16; 'urllib': 0.16; '(or': 0.18; 'respective': 0.20; 'received:209.85.214.174': 0.21; 'cc:2**0': 0.23; 'insert': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'possibly': 0.27; 'message-id:@mail.gmail.com': 0.27; 'post': 0.28; 'source': 0.29; 'error': 0.30; 'received:google.com': 0.34; 'text': 0.34; 'received:209.85': 0.35; 'except': 0.36; 'skip:u 20': 0.36; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'received:209.85.214': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'skip:u 10': 0.60; 'url:index': 0.61; 'here': 0.65; 'url:cgi': 0.65; 'entry,': 0.84; 'opener': 0.84; 'stored,': 0.84; 'url:lang': 0.84; 'url:biz': 0.91; 'url:fr': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=rlrrpXr1q3XJp4XhfrcIoXw4YA/nwhhJBIPTw0Cp0BY=; b=s9KbrzCEuBLUy6h+MmLPqz3zyW1CSWPXsuTbnhkbJ5s2JK20GJ4QDjGkUK3Y4l99vk wGeWapcFz/v0ypftEUi1DiF74f3FZalS+R78KcUX8kHISBWm4LP9huc/m02d+1993pOh FDmM89DEtwyZrNUj7XMi9bdZnNvaygX3h59K3lQpzb57dcWgbFbbwWOMMM/+uPpZ4uYb 7DSKOrBPr/xx02XD7bBHhoH01dh/xtaQXXu8tovnYOxJSNylT5uO0v3hKbJkqCZFkd9p JMBkFGgos3CDSDHpPGmTHzWPNCI0goAq4UZPkkD45/iQCnCb06+xa1G79DgTn0IeZRYJ VjvQ== MIME-Version: 1.0 In-Reply-To: References: <50ceb674$0$29868$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 17 Dec 2012 12:14:09 +0100 Subject: Re: Unicode From: Anatoli Hristov To: Vlastimil Brom Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355742852 news.xs4all.nl 6986 [2001:888:2000:d::a6]:39720 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34971 > this seems to be an encoding error of your terminal on printing. > You may need to describe (or better post the respective parts of the > source) where the text is coming from (external text file, database > entry, harcoded in the python source ...), how it is stored, retrieved > and possibly manipulated before you insert it to the database. > Here is how I get the data using the urllib opener: def GetSpecsFR(icecat_prod_id): opener = urllib.FancyURLopener({}) ffr = opener.open("http://prf.icecat.biz/index.cgi?product_id=%s;mi=start;smi=product;shopname=openICEcat-url;lang=fr" % icecat_prod_id) specsfr = ffr.read() #specsfr = specsfr.decode('utf-8') specsfr = RemoveHTML(specsfr) ##specsfr = "%r" % specsfr ## if specsfr: ## try: ## specsfr = str(specsfr) ## except UnicodeEncodeError: ## specsfr = str(specsfr.encode('utf-16')) return specsfr