Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

6 May, 2024: The networking issue during the past two days has been identified and fixed.


devel / comp.lang.python / Re: imaplib: is this really so unwieldy?

SubjectAuthor
o Re: imaplib: is this really so unwieldy?Dennis Lee Bieber

1
Re: imaplib: is this really so unwieldy?

<mailman.340.1621961906.3087.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13325&group=comp.lang.python#13325

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: wlfr...@ix.netcom.com (Dennis Lee Bieber)
Newsgroups: comp.lang.python
Subject: Re: imaplib: is this really so unwieldy?
Date: Tue, 25 May 2021 11:41:02 -0400
Organization: IISS Elusive Unicorn
Lines: 25
Message-ID: <mailman.340.1621961906.3087.python-list@python.org>
References: <21fb6c5f-97a4-654b-887f-2c31a549bcbe@adminart.net>
<hd6qag98c37mvqurlu3mfcvie38o63kn6n@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de gEJYoWeQY8lj68u4NoytiAfCcsKHK3TmhgiOJSQ3fEEQ==
Return-Path: <python-python-list@m.gmane-mx.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(which': 0.04; 'utf-8':
0.07; 'convert': 0.09; 'forced': 0.09; 'received:ciao.gmane.io':
0.09; 'received:gmane.io': 0.09; 'received:list': 0.09;
"shouldn't": 0.09; '+0200,': 0.16; 'bytes)': 0.16; 'characters.':
0.16; 'encoding': 0.16; 'expressions': 0.16; 'message-
id:@4ax.com': 0.16; 'recall': 0.16; 'received:116.202': 0.16;
'received:116.202.254': 0.16; 'received:116.202.254.214': 0.16;
'skip:> 10': 0.16; 'python': 0.16; 'tue,': 0.18; 'to:addr:python-
list': 0.23; 'binary': 0.27; 'extract': 0.27; 'wrong': 0.27;
'function': 0.28; 'input': 0.29; 'header:User-Agent:1': 0.31;
'header:Organization:1': 0.31; 'there': 0.31; 'stuff': 0.31;
'expect': 0.31; "i'm": 0.32; 'half': 0.32; 'using': 0.33;
'functions': 0.34; 'really': 0.37; 'use': 0.38; 'subject:this':
0.63; 'per': 0.64; 'your': 0.64; 'produce': 0.69; 'received:116':
0.71; '2021': 0.84; 'strings': 0.84; 'subject:really': 0.84; 'url-
ip:76/8': 0.84; 'weird': 0.84
X-Injected-Via-Gmane: http://gmane.org/
User-Agent: ForteAgent/8.00.32.1272
X-No-Archive: YES
X-Mailman-Approved-At: Tue, 25 May 2021 12:58:25 -0400
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
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: <hd6qag98c37mvqurlu3mfcvie38o63kn6n@4ax.com>
X-Mailman-Original-References: <21fb6c5f-97a4-654b-887f-2c31a549bcbe@adminart.net>
 by: Dennis Lee Bieber - Tue, 25 May 2021 15:41 UTC

On Tue, 25 May 2021 10:23:41 +0200, hw <hw@adminart.net> declaimed the
following:

>
>So I'm forced to convert stuff from bytes to strings (which is weird
>because bytes are bytes) and to use regular expressions to extract the
>message-uids from what the functions return (which I shouldn't have to
>because when I'm asking a function to give me a uid, I expect it to
>return a uid).
>
In Python 3, strings are UNICODE, using 1, 2, or 4 bytes PER CHARACTER
(I don't recall if there is a 3-byte version). If your input bytes are all
7-bit ASCII, then they map directly to a 1-byte per character string. If
they contain any 8-bit upper half character they may map into a 2-byte per
character string.

Bytes in Python 3 are just a binary stream, which needs an encoding to
produce characters. Use the wrong encoding (say ISO-Latin-1) when the data
is really UTF-8 will result in garbage.

--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor