🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: de.sci.physik
Article #119

Re: Verschraenkung

#119
From: Stefan Ram
Date: Mon, 16 Nov 2026 10:41
265 lines
12160 bytes
Carla Schneider <carla_schn@proton.me> schrieb oder zitierte:
>Inwiefern kann eine Definition falsch sein (?)

  Das ist lustig, da mir vor kurzem ja in de.sci.mathematik dieselbe
  Frage gestellt wurde!

  Wenn man zum Beispiel sagt, "Das ist das falsche Kleid!", dann meint
  man damit nicht, daß das Kleid eine unwahre Aussage sei, sondern daß
  es nicht das beabsichtigte oder gesuchte Kleid ist. "Falsch" bedeutet
  also auch "auf Grund eines Irrtums mit dem Beabsichtigten, Gemeinten 
  nicht übereinstimmend" ("Wörterbuch Deutsch als Fremdsprache" (2000) 
  - Günter Kempcke).

  Eine Definition ist also falsch, wenn sie nicht das eigentlich Gemein-
  te ausdrückt, wie zum Beispiel in dem folgenden Fall: Ein Schüler wird
  gebeten, zu definieren, was ein Substantiv sei. Er definiert ein Wort
  als Substantiv, das "eine Bewegung hin zum Sprecher" ausdrückt. Diese 
  Definition ist falsch, weil sie nicht mit dem übereinstimmt, was nor-
  malerweise mit "Substantiv" gemeint ist und vom Lehrer erwartet wurde.

>Das usenet ist seit 20 Jahren am langsamen sterben, es gibt
>keine neueren vernuenftig funktionierenden Newsreader. 

  Es gibt schon Newsreader mit Unicode-Unterstützung, aber man kann im
  Usenet auch noch mit ISO-8859-1 kommunizieren. Ich fände es schön,
  wenn alle Unicode verwenden würden, aber das ist nicht so. Insbeson-
  dere in englischsprachigen Newsgroups können einige sogar nur ASCII
  lesen.

  Wenn es nur um das Lesen eines Unicode-Artikels geht, sollte dies aber
  auch ohne Newsreader mit einem kleinen Python-Skript möglich sein,
  das diesen Artikel von einem Newsreader abholt und dann im System-
  browser anzeigt. Unten habe ich ein ungetestetes Beispiel für Python
  3.12 angehängt, für das unter Python ab 3.13 aber noch "pip install 
  standard-nntplib" nachinstalliert werden müßte.

. . .
>Das sieht wenn A und B z.B. 300km voneinander entfernt sind  nach einer ueberlichtschnellen
>Informationsuebertragung aus...

  Es /ist/ eine überlichtschnelle Informationsübertragung, wie auch
  Griffiths feststellt. Einige wollen hier aber nicht von "Information"
  sprechen, sondern einen anderen Begriff verwenden. Griffiths spricht
  beispielsweise von einer "spukhaften Fernwirkung" ("ethereal influ-
  ence"), die /keine/ Information überträgt. - Ich würde sagen, daß sie
  schon Information überträgt, aber nur über dieses Meßergebnis. Und
  damit sind wir wieder bei der Frage der Begriffsdefinitionen . . .

|We are led, then, to distinguish two types of influence: 
|the "causal" variety, which produce actual changes in some
|physical property of the receiver, detectable by measurements
|on that subsystem alone, and an "ethereal" kind, which do not
|transmit energy or information, and for which the only
|evidence is a correlation in the data taken on the two
|separate subsystems - a correlation which by its nature cannot
|be detected by examining either list alone. Causal influences
|cannot propagate faster than light, but there is no compelling
|reason why ethereal ones should not. The influences associated
|with the collapse of the wave function are of the latter type,
|and the fact that they "travel" faster than light may be
|surprising, but it is not, after all, catastrophic.
"Introduction to Quantum Mechanics" - David J. Griffiths.

# Python-3.12-Skript, ungetestet, keine Gewähr! 

import email
from email import policy
from email.header import decode_header, make_header
import html
import nntplib
import os
import tempfile
import webbrowser

# ==========================================
# KONFIGURATION (Konstanten am Skriptanfang)
# ==========================================
MESSAGE_ID = "<beispiel-id-12345@news.example.org>"
NNTP_HOST = "news.example.org"
NNTP_PORT = 563  # Typisch: 563 für NNTP über SSL/TLS, 119 für unverschlüsselt
NNTP_USER = "benutzername"
NNTP_PASS = "passwort"
USE_SSL = True

def decode_mime_header(header_value: str) -> str:
    """Dekodiert MIME-kodierte Kopfzeilen (z. B. =?UTF-8?Q?...?=) in lesbaren Text."""
    if not header_value:
        return ""
    try:
        return str(make_header(decode_header(header_value)))
    except Exception:
        return header_value


def extract_body(msg: email.message.EmailMessage) -> tuple[str, bool]:
    """Extrahiert den Text-Rumpf aus der Nachricht (bevorzugt text/plain, alternativ text/html)."""
    plain_text = None
    html_text = None

    if msg.is_multipart():
        for part in msg.walk():
            content_type = part.get_content_type()
            content_disposition = str(part.get("Content-Disposition", ""))
            if "attachment" in content_disposition:
                continue

            if content_type == "text/plain" and plain_text is None:
                plain_text = part.get_content()
            elif content_type == "text/html" and html_text is None:
                html_text = part.get_content()
    else:
        content_type = msg.get_content_type()
        if content_type == "text/html":
            html_text = msg.get_content()
        else:
            plain_text = msg.get_content()

    if plain_text is not None:
        return plain_text, False
    if html_text is not None:
        return html_text, True
    return "(Kein lesbarer Textinhalt gefunden)", False


def build_html(headers: dict[str, str], body: str, is_html_body: bool) -> str:
    """Erzeugt ein vollständiges, sauber formatiertes HTML-Dokument."""
    header_rows = ""
    for key, value in headers.items():
        if value:
            safe_key = html.escape(key)
            safe_val = html.escape(value)
            header_rows += f"<tr><th>{safe_key}</th><td>{safe_val}</td></tr>\n"

    if is_html_body:
        body_section = f'<div class="html-body">{body}</div>'
    else:
        safe_body = html.escape(body)
        body_section = f'<pre class="plain-body">{safe_body}</pre>'

    return f"""<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{html.escape(headers.get("Subject", "Usenet-Artikel"))}</title>
    <style>
        body {{
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            line-height: 1.6;
            color: #222;
            max-width: 900px;
            margin: 2rem auto;
            padding: 0 1rem;
            background-color: #f9f9fb;
        }}
        .container {{
            background: #fff;
            border: 1px solid #dcdce0;
            border-radius: 8px;
            padding: 1.5rem 2rem;
            box-shadow: 0 2px 6px rgba(0,0,0,0.05);
        }}
        table.headers {{
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 1.5rem;
            font-size: 0.92rem;
            border-bottom: 2px solid #e2e2e8;
        }}
        table.headers th {{
            text-align: left;
            width: 140px;
            padding: 6px 10px;
            color: #555;
            vertical-align: top;
        }}
        table.headers td {{
            padding: 6px 10px;
            word-break: break-word;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        }}
        pre.plain-body {{
            white-space: pre-wrap;
            word-wrap: break-word;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
            font-size: 0.95rem;
            background: #fdfdfd;
            padding: 1rem;
            border-radius: 4px;
        }}
    </style>
</head>
<body>
    <div class="container">
        <table class="headers">
            {header_rows}
        </table>
        {body_section}
    </div>
</body>
</html>
"""


def fetch_and_display_article():
    # Sicherstellen, dass die Message-ID in spitzen Klammern steht
    msg_id = MESSAGE_ID.strip()
    if not (msg_id.startswith("<") and msg_id.endswith(">")):
        msg_id = f"<{msg_id}>"

    print(f"Verbinde mit {NNTP_HOST}:{NNTP_PORT}...")
    if USE_SSL:
        server = nntplib.NNTP_SSL(
            NNTP_HOST, port=NNTP_PORT, user=NNTP_USER, password=NNTP_PASS
        )
    else:
        server = nntplib.NNTP(
            NNTP_HOST, port=NNTP_PORT, user=NNTP_USER, password=NNTP_PASS
        )

    try:
        print(f"Rufe Artikel {msg_id} ab...")
        _, info = server.article(msg_id)
        # Die Zeilen kommen als Liste von Bytes zurück -> mit CRLF zusammensetzen
        raw_article = b"\r\n".join(info.lines)
    finally:
        server.quit()

    # Artikel mit moderner Email-Policy parsen (dekodiert Zeichensätze und Transfer-Encodings)
    msg = email.message_from_bytes(raw_article, policy=policy.default)

    # Wichtige Kopfzeilen extrahieren und MIME-dekodieren
    header_keys = [
        "From",
        "Newsgroups",
        "Subject",
        "Date",
        "Message-ID",
        "Organization",
        "User-Agent",
    ]
    decoded_headers = {
        key: decode_mime_header(msg.get(key, "")) for key in header_keys
    }

    # Rumpf extrahieren
    body_text, is_html = extract_body(msg)

    # HTML generieren und in temporäre Datei schreiben
    html_output = build_html(decoded_headers, body_text, is_html)

    with tempfile.NamedTemporaryFile(
        mode="w", suffix=".html", encoding="utf-8", delete=False
    ) as tmp_file:
        tmp_file.write(html_output)
        temp_path = tmp_file.name

    print(f"Öffne Artikel im Systembrowser: {temp_path}")
    webbrowser.open(f"file://{os.path.abspath(temp_path)}")


if __name__ == "__main__":
    fetch_and_display_article()

Technical Details
Message-ID: <Verschraenkung-20261116113628@ram.dialup.fu-berlin.de>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
References: <63f1a1b2.0409250452.5ff357a5@posting.google.com> <cj4a94$dsd$04$1@news.t-online.com> <2rlqp9F1bflroU1@uni-berlin.de> <cj4muj$ilt$00$1@news.t-online.com> <2rm683F1bhijmU1@uni-berlin.de> <cj4p4o$1sq$04$1@news.t-online.com> <cja964$cj6$00$1@news.t-online.com> <2rsrrtF1eu1naU1@uni-berlin.de> <cjbvel$4q9$00$1@news.t-online.com> <2rugu1F1d0un8U1@uni-berlin.de> <cjej1u$qtl$04$1@news.t-online.com> <2s08noF1ff9gkU1@uni-berlin.de> <cjfq8t$cmj$02$1@news.t-online.com> <2s2m2tF1fdujpU1@uni-berlin.de> <Verschraenkung-20261105161307_-_@ram.dialup.fu-berlin.de> <6AED0A49.36F69665@proton.me> <Kontext-20261106120130@ram.dialup.fu-berlin.de> <Verschraenkung-20261106155217@ram.dialup.fu-berlin.de> <11cqvuo$8mjq$1@gwaiyur.mb-net.net> <6AF3B3ED.113C4245@proton.me> <11dcnc5$b89$1@gwaiyur.mb-net.net> <6AFAD44A.1913A2E@proton.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: de.sci.physik
Subject: Re: Verschraenkung
Date: 16 Nov 2026 10:41:18 GMT
Organization: Stefan Ram
Lines: 265
Expires: 1 Dec 2027 11:59:58 GMT
Message-ID: <Verschraenkung-20261116113628@ram.dialup.fu-berlin.de>
References: <63f1a1b2.0409250452.5ff357a5@posting.google.com> <cj4a94$dsd$04$1@news.t-online.com> <2rlqp9F1bflroU1@uni-berlin.de> <cj4muj$ilt$00$1@news.t-online.com> <2rm683F1bhijmU1@uni-berlin.de> <cj4p4o$1sq$04$1@news.t-online.com> <cja964$cj6$00$1@news.t-online.com> <2rsrrtF1eu1naU1@uni-berlin.de> <cjbvel$4q9$00$1@news.t-online.com> <2rugu1F1d0un8U1@uni-berlin.de> <cjej1u$qtl$04$1@news.t-online.com> <2s08noF1ff9gkU1@uni-berlin.de> <cjfq8t$cmj$02$1@news.t-online.com> <2s2m2tF1fdujpU1@uni-berlin.de> <Verschraenkung-20261105161307_-_@ram.dialup.fu-berlin.de> <6AED0A49.36F69665@proton.me> <Kontext-20261106120130@ram.dialup.fu-berlin.de> <Verschraenkung-20261106155217@ram.dialup.fu-berlin.de> <11cqvuo$8mjq$1@gwaiyur.mb-net.net> <6AF3B3ED.113C4245@proton.me> <11dcnc5$b89$1@gwaiyur.mb-net.net> <6AFAD44A.1913A2E@proton.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de WIj7vunTc7ThdEg9RJY+TQ4wg5kG2wk5dngIm3C2MpTa//
Cancel-Lock: sha1:Wc7IqCmQ27F+lrQM4x1G0Lxza54= sha256:zEhC1SFw2Y9urvJ7XUHlDc39cGJ04o/MXBcjR4b1cy0=
X-Copyright: (C) Copyright 2026 Stefan Ram. All rights reserved.
	Distribution through any means other than regular usenet
	channels is forbidden. It is forbidden to publish this
	article in the Web, to change URIs of this article into links,
        and to transfer the body without this notice, but quotations
        of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
	services to mirror the article in the web. But the article may
	be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: de