Deutsch English Français Italiano |
<mailman.159.1718991773.2909.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico <rosuav@gmail.com> Newsgroups: comp.lang.python Subject: Re: Decoding bytes to text strings in Python 2 Date: Sat, 22 Jun 2024 03:42:39 +1000 Lines: 24 Message-ID: <mailman.159.1718991773.2909.python-list@python.org> References: <MPG.40dfb14de0110a999896df@news.eternal-september.org> <CAPTjJmpAYU2yxUhJd2mG4vkkK7JsViyF+7oat_Gw=AmfNi=A8g@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: news.uni-berlin.de 03COOvz6IOZQqZuNvZSCKQ1huqAvbExMWtG+xcTf39Gg== Cancel-Lock: sha1:0w+ovxaj1oCTRhKUFzkqH+yp9jw= sha256:s7TSGc5WISCGMwqJQmEiaYWuV2V6kgBcd0tWjAk0GNw= Return-Path: <rosuav@gmail.com> X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org Authentication-Results: mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=arPeBbXr; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'tkinter': 0.07; 'debian': 0.09; 'linux': 0.09; 'subject:Python': 0.12; 'problem.': 0.15; '(because': 0.16; '*think*': 0.16; '2024': 0.16; 'characters.': 0.16; 'chrisa': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ported': 0.16; 'solved': 0.16; 'unicode': 0.16; 'windows:': 0.16; 'wrote:': 0.16; 'python': 0.16; 'to:addr:python- list': 0.20; 'written': 0.22; "i've": 0.22; 'sat,': 0.22; 'install': 0.23; 'jun': 0.26; 'old': 0.27; "doesn't": 0.32; 'encountered': 0.32; 'python-list': 0.32; 'message- id:@mail.gmail.com': 0.32; 'but': 0.32; "i'm": 0.33; 'windows': 0.34; 'able': 0.34; 'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34; 'running': 0.34; 'from:addr:gmail.com': 0.35; 'system,': 0.36; 'using': 0.37; "it's": 0.37; 'way': 0.38; 'rest': 0.39; 'support.': 0.40; 'something': 0.40; 'should': 0.40; 'provide': 0.60; "there's": 0.61; 'once': 0.63; 'updating': 0.64; 'let': 0.66; 'that,': 0.67; 'know.': 0.68; 'longer': 0.71; 'relevant': 0.73; "you'll": 0.73; 'operate': 0.75; 'bothered': 0.84; 'lucas': 0.91; 'migrate': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718991771; x=1719596571; darn=python.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=CjBHVCi3G7F4BEjEcTUw51HMSULU+hbms9rLvIlSa5k=; b=arPeBbXrEWbWnDLHDWYCPBOJAu/w5h99tvRJgAn/1ei0DXImND/DwGrNfG66Fw2SRP 9RgNPGv0VQPwEdCH2XJ+ElA0oiot94AepkVrqHmoJNPxNnOCdTnYvj8WK1eAuAfBlA2c WBAhgwQBsczjLPVvI68Rkep4tlIIrMnH1oGKRhW60Z6l/rUJK0SGxILQQ53LGWcXK0Rj O8um3+uQ2WmfUfXgC06xxCdtn18Zh+GQeH9xzHG5NHgwLN9ofScCwjHvbSOSZ+A55vQB v3wLPLKaCFCWCVsgaNkrVgM9BqcIhUkI5OCOT+tzmniUAkq1Y+M2GJHo8qTZirm3/Ofm Qjgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718991771; x=1719596571; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CjBHVCi3G7F4BEjEcTUw51HMSULU+hbms9rLvIlSa5k=; b=mO2YWyldYWULcKlcDxUKFH0CyJzez2T32at4XH/uFdcwmnOnokkc90rtyI2QTm6i0+ qvdaopw6IWTriC8W2prQvOHkSCAlbTPBdOaMwwxhyxLZZB53Vw0XirsCCN5HqR6bPm/2 mtYY3hzj9jbVHvNO7811g8G6u7S9iPg4wZ5KIcTzcuPhThENSc0g80JFEoUe/0NX/TUl 1DMv2pMSfSTnTdgmUVyFgJ49EeOoZ1CNHGnGUtAx6m7Hu3oJxAmrzt7Ug1A/fP67VbIT LbSysOJLK2ir49vsid16WXkd1gV6iPrbeqINruOK6+Ko50O8kO2wCyKSLLfpiDfpZf3j l2Ng== X-Gm-Message-State: AOJu0YwEAbdBy3Zggv0tVi4r/7MMyBibTbgi2HPViC82rLj0XGjFiCNp COej04EazJEotiryFExdiQyn8MNY7Yzj0hmTK97mjDJoh021/ZT7bx0fmQjtV2uEhBAzJQ4W9RE hPxMGkP1NNYGvHAmgj5bRadzaCF9Tbw== X-Google-Smtp-Source: AGHT+IFaFycFFhEFpP3wvbwcCqJRWYebhCZNdyGd6jKwZyBbyP4uQGPK6/hro7DBoTc9UAMiboblCVZPl7XNb5aLrsc= X-Received: by 2002:a05:6512:312f:b0:52c:dac3:392b with SMTP id 2adb3069b0e04-52cdac33a98mr920839e87.33.1718991770611; Fri, 21 Jun 2024 10:42:50 -0700 (PDT) In-Reply-To: <MPG.40dfb14de0110a999896df@news.eternal-september.org> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: General discussion list for the Python programming language <python-list.python.org> List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> List-Archive: <https://mail.python.org/pipermail/python-list/> List-Post: <mailto:python-list@python.org> List-Help: <mailto:python-list-request@python.org?subject=help> List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> X-Mailman-Original-Message-ID: <CAPTjJmpAYU2yxUhJd2mG4vkkK7JsViyF+7oat_Gw=AmfNi=A8g@mail.gmail.com> X-Mailman-Original-References: <MPG.40dfb14de0110a999896df@news.eternal-september.org> Bytes: 6157 On Sat, 22 Jun 2024 at 03:28, Rayner Lucas via Python-list <python-list@python.org> wrote: > I'm curious about something I've encountered while updating a very old > Tk app (originally written in Python 1, but I've ported it to Python 2 > as a first step towards getting it running on modern systems). > > I am using Python 2.7.18 on a Windows 10 system. If there's any other > relevant information I should provide please let me know. Unfortunately, you're running into one of the most annoying problems from Python 2 and Windows: "narrow builds". You don't actually have proper Unicode support. You have a broken implementation that works for UCS-2 but doesn't actually support astral characters. If you switch to a Linux system, it should work correctly, and you'll be able to migrate the rest of the way onto Python 3. Once you achieve that, you'll be able to operate on Windows or Linux equivalently, since Python 3 solved this problem. At least, I *think* it will; my current system has a Python 2 installed, but doesn't have tkinter (because I never bothered to install it), and it's no longer available from the upstream Debian repos, so I only tested it in the console. But the decoding certainly worked. ChrisA