Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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; 'terry': 0.07; 'python': 0.07; 'everybody,': 0.09; '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; 'url:dev': 0.09; 'url:peps': 0.09; 'pm,': 0.11; 'this:': 0.11; 'am,': 0.14; 'wrote:': 0.14; 'an:': 0.16; 'codec': 0.16; 'declaration;': 0.16; 'literals:': 0.16; 'ordinal': 0.16; 'rebert': 0.16; 'reedy': 0.16; 'subject: ???': 0.16; 'subject:unicode': 0.16; 'url:pep-0263': 0.16; 'traceback': 0.16; '(most': 0.16; 'tue,': 0.20; 'language': 0.20; 'appropriate': 0.21; 'jan': 0.22; 'header:In-Reply-To:1': 0.22; 'itself.': 0.22; 'last):': 0.23; 'example': 0.24; 'byte': 0.25; 'chris': 0.27; 'string': 0.29; 'error': 0.29; 'unicode': 0.29; 'probably': 0.30; "can't": 0.31; 'to:addr:python-list': 0.32; 'source': 0.32; 'header:X-Complaints-To:1': 0.34; 'file': 0.35; 'header:User-Agent:1': 0.35; '"",': 0.35; '???': 0.35; 'url:python': 0.37; 'apr': 0.38; 'strings': 0.38; 'but': 0.38; 'url:org': 0.38; 'received:org': 0.38; 'to:addr:python.org': 0.39; 'could': 0.39; 'header:Mime-Version:1': 0.39; 'how': 0.39; 'add': 0.39; 'header:Received:5': 0.40; '8bit%:11': 0.60; '2011': 0.62; '26,': 0.68; 'concatenate': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: How to concatenate unicode strings ??? Date: Tue, 26 Apr 2011 12:41:40 -0400 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: rain.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 In-Reply-To: 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: 30 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303836119 news.xs4all.nl 41113 [::ffff:82.94.164.166]:46426 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:4054 On 4/26/2011 12:07 PM, Chris Rebert wrote: > On Tue, Apr 26, 2011 at 8:58 AM, Ariel wrote: >> Hi everybody, how could I concatenate unicode strings ??? >> What I want to do is this: >> >> unicode('this an example language ') + unicode('espa=C3=B1ol') >> >> but I get an: >> Traceback (most recent call last): >> File "", line 1, in >> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1= 1: >> ordinal not in range(128) >> >> How could I concatenate unicode strings ??? > > That error is from the 2nd call to unicode(), not from the > concatenation itself. Use proper Unicode string literals: > > u'this an example language ' + u'espa=C3=B1ol' > > You'll probably also need to add the appropriate source file encoding > declaration; see http://www.python.org/dev/peps/pep-0263/ Or use Python 3 --=20 Terry Jan Reedy