Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed4a.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; 'string': 0.09; '3),': 0.09; 'ascii': 0.09; 'assuming': 0.09; 'bytes,': 0.09; 'integers': 0.09; 'subject:into': 0.09; 'subject:string': 0.09; 'subject:How': 0.10; 'python': 0.11; '2),': 0.16; 'bytes;': 0.16; 'encoding.': 0.16; 'expecting': 0.16; 'range,': 0.16; 'wrote:': 0.18; 'library': 0.18; 'all,': 0.19; 'bit': 0.19; 'thu,': 0.19; '(the': 0.22; 'byte': 0.24; 'certainly': 0.24; 'lets': 0.24; 'unicode': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'characters': 0.30; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; '(which': 0.31; 'correctly.': 0.31; 'sep': 0.31; 'could': 0.34; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'different': 0.65; 'default': 0.69 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=CdyPFcbC9NVGmmfxQkAVwTZrZBagkxadZVZxATKMMLQ=; b=x4A5ggvcKtzSC+8HlrXkr/VOj+q7B/hdUJRTeo2zv4reIhZ53VLZ3fRJq0X1Lu4NhS 35KTrrnQPPocQYYBnvba9gZRRaHbFzuSCwhHX/OSYu11RaOi/OAgBE2IKoCxnek96FwL hOWRRVhCFT4d3NfauvZvm4l+1fCeHwW++/j5ITobquQ7DZJOuQeL531yaDN98AbTEesl vLIiHe8vFYdQ0pAMUU4mToKcMFq6FrTkwdkwl+tYDXROQrGZkR++wRQTJjeM0YJ9rgO1 FrBoDpBBSdLf+N2/qBXk6RfYzRvqBF+SRU9+Cf1VcJFANXOgj0STgf9rnhkZrjju3T/V +qrQ== X-Received: by 10.66.161.41 with SMTP id xp9mr15658764pab.120.1409882982084; Thu, 04 Sep 2014 19:09:42 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1amjdb-p3n.ln1@chris.zbmc.eu> From: Ian Kelly Date: Thu, 4 Sep 2014 20:09:01 -0600 Subject: Re: How to turn a string into a list of integers? To: Python Content-Type: text/plain; charset=UTF-8 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1409882991 news.xs4all.nl 2905 [2001:888:2000:d::a6]:54309 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77566 On Thu, Sep 4, 2014 at 6:12 PM, Chris Angelico wrote: > If it's a Unicode string (which is the default in Python 3), all > Unicode characters will work correctly. Assuming the library that needs this is expecting codepoints and will accept integers greater than 255. > If it's a byte string (the > default in Python 2), then you can't actually have any Unicode > characters in it at all, you have bytes; Py2 lets you be a bit sloppy > with the ASCII range, but technically, you still have bytes, not > characters.. In that case the library will almost certainly accept it, but could be expecting a different encoding.