Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'prints': 0.07; 'python': 0.08; 'output': 0.10; 'am,': 0.12; 'received:209.85.210.174': 0.13; 'received:mail-iy0-f174.google.com': 0.13; 'declaring': 0.16; 'different,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hi;': 0.16; 'iverson': 0.16; 'py3': 0.16; 'stan': 0.16; 'wrote:': 0.18; 'advise.': 0.18; 'slightly': 0.19; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'guess': 0.26; 'message-id:@mail.gmail.com': 0.28; 'print': 0.29; 'there': 0.33; 'object': 0.33; 'fri,': 0.34; 'to:addr:python- list': 0.34; 'things': 0.34; 'however,': 0.36; 'file': 0.36; 'problem.': 0.36; 'question': 0.36; 'encoding': 0.37; 'page': 0.37; 'received:google.com': 0.37; 'using': 0.38; 'received:209.85': 0.38; 'being': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'your': 0.61; 'spanish': 0.64 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=121wmZO/sqreC2tcDiJCioIVCX5DREWxKkclMm/SeLU=; b=qg5OGU8UoSpIenInLj7QHFVUMGPFumxy7PXqmnXSwiKp8f2fc0qaMRuDYi+LU+lHfv xv3KaDctGFn0JR+QMzf/ljGNrxj7zknZy4qfmr3MWV0KSssD1+cRb5NmiY45eeaadLGd jlJ/sQQjKemdVhLZjTAiDTy1rA968YKZ2C+eo= MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 23 Dec 2011 01:58:43 +1100 Subject: Re: Spanish Accents From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1324565926 news.xs4all.nl 6976 [2001:888:2000:d::a6]:53785 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17737 On Fri, Dec 23, 2011 at 1:55 AM, Stan Iverson wrote: > Hi; > If I write a python page to print to the web with Spanish accents all is > well. However, if I read the data from a text file it prints diamonds with > question marks wherever there are accented vowels. Please advise. Sounds like an encoding problem. Firstly, are you using Python 2 or Python 3? Things will be slightly different, since the default 'str' object in Py3 is Unicode. I would guess that your page is being output as UTF-8; you may find that the solution is as easy as declaring the encoding of your text file when you read it in. ChrisA