Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #6154 > unrolled thread

[Python-de] Re: Codepage-Methode und Basis 4096

Started by"Wolli Buechel" <wjb131@web.de>
First post2024-08-09 05:18 +0000
Last post2024-08-11 20:40 +0000
Articles 13 — 2 participants

Back to article view | Back to de.comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [Python-de] Re: Codepage-Methode und Basis 4096 "Wolli Buechel" <wjb131@web.de> - 2024-08-09 05:18 +0000
    [Python-de] Fwd: Codepage-Methode und Basis 4096 Erich Schnoor <eschnoor@multi-matrix.de> - 2024-08-09 11:25 +0200
      [Python-de] Re: Fwd: Codepage-Methode und Basis 4096 "Wolli Buechel" <wjb131@web.de> - 2024-08-09 17:50 +0000
        [Python-de] Fwd: Codepage-Methode und Basis 4096 Erich Schnoor <eschnoor@multi-matrix.de> - 2024-08-09 21:52 +0200
          [Python-de] Re: Fwd: Codepage-Methode und Basis 4096 "Wolli Buechel" <wjb131@web.de> - 2024-08-10 08:25 +0000
            [Python-de] Fwd: Codepage-Methode und Basis 4096 Erich Schnoor <eschnoor@multi-matrix.de> - 2024-08-10 11:48 +0200
              [Python-de] Re: Fwd: Codepage-Methode und Basis 4096 "Wolli Buechel" <wjb131@web.de> - 2024-08-13 09:28 +0000
          [Python-de] Re: Fwd: Codepage-Methode und Basis 4096 "Wolli Buechel" <wjb131@web.de> - 2024-08-10 16:36 +0000
            [Python-de] Fwd: Codepage-Methode und Basis 4096 Erich Schnoor <eschnoor@multi-matrix.de> - 2024-08-11 11:44 +0200
              [Python-de] Re: Fwd: Codepage-Methode und Basis 4096 "Wolli Buechel" <wjb131@web.de> - 2024-08-11 15:22 +0000
                [Python-de] Fwd: Codepage-Methode und Basis 4096 Erich Schnoor <eschnoor@multi-matrix.de> - 2024-08-11 19:06 +0200
                  [Python-de] Re: Fwd: Codepage-Methode und Basis 4096 "Wolli Buechel" <wjb131@web.de> - 2024-08-11 20:36 +0000
                    [Python-de] Re: Fwd: Codepage-Methode und Basis 4096 "Wolli Buechel" <wjb131@web.de> - 2024-08-11 20:40 +0000

#6154 — [Python-de] Re: Codepage-Methode und Basis 4096

From"Wolli Buechel" <wjb131@web.de>
Date2024-08-09 05:18 +0000
Subject[Python-de] Re: Codepage-Methode und Basis 4096
Message-ID<172318071548.23241.14072652885565966963@mail.python.org>
Sehr geehrter Herr Schnoor,

könnten Sie bitte statt "Herbstzeitlose" als Teststring  den text = "ABCäöü߀𝄞"  in Ihr Programm eingeben?
Ich habe das Problem, dass die Rückübersetzung nicht richtig funktioniert.

W. Büchel

[toc] | [next] | [standalone]


#6156 — [Python-de] Fwd: Codepage-Methode und Basis 4096

FromErich Schnoor <eschnoor@multi-matrix.de>
Date2024-08-09 11:25 +0200
Subject[Python-de] Fwd: Codepage-Methode und Basis 4096
Message-ID<81BF95A9-21D7-4556-AE53-6AF8BBA65841@multi-matrix.de>
In reply to#6154
Sehr geehrter Herr Büchel,

hier die Rückübersetzung des Teststrings:  "ABCäöü߀𝄞”:

  position choosen > e
                                                     received data and reading
 received data?  > 
binfolge.bin

 row of <binär>data: 
000000000100000100000000010000100000000001000011000000001110010000000000111101100000000011111100000000001101111100100000101011001101000100011110

 original text received: 
 ABCäöü߀턞

 sequence of <index>data:
 Ã Ä Å ŧ Ź ſ Ţ 2į dơ 
                                    Transdata-file has gotten the name: > Original.txt

Hier hat alles funktioniert.
Mit freundlichen Grüßen
Erich Schnoor 

> Anfang der weitergeleiteten Nachricht:
> 
> Von: Wolli Buechel über python-de <python-de@python.org>
> Betreff: [Python-de] Re: Codepage-Methode und Basis 4096
> Datum: 9. August 2024 um 07:18:35 MESZ
> An: python-de@python.org
> Antwort an: Wolli Buechel <wjb131@web.de>
> 
> Sehr geehrter Herr Schnoor,
> 
> könnten Sie bitte statt "Herbstzeitlose" als Teststring  den text = "ABCäöü߀𝄞"  in Ihr Programm eingeben?
> Ich habe das Problem, dass die Rückübersetzung nicht richtig funktioniert.
> 
> W. Büchel
> _______________________________________________
> python-de Mailingliste -- python-de@python.org
> Zur Abmeldung von dieser Mailingliste senden Sie eine Nachricht an python-de-leave@python.org
> https://mail.python.org/mailman3/lists/python-de.python.org/
> Mitgliedsadresse: eschnoor@multi-matrix.de

[toc] | [prev] | [next] | [standalone]


#6157 — [Python-de] Re: Fwd: Codepage-Methode und Basis 4096

From"Wolli Buechel" <wjb131@web.de>
Date2024-08-09 17:50 +0000
Subject[Python-de] Re: Fwd: Codepage-Methode und Basis 4096
Message-ID<172322580693.6477.10826769256444939539@mail.python.org>
In reply to#6156
> hier die Rückübersetzung des Teststrings:  "ABCäöü߀𝄞”:

>  ABCäöü߀턞
> 
>  sequence of <index>data:
>  Ã Ä Å ŧ Ź ſ Ţ 2į dơ 

Das letzte Zeichen (𝄞, Violinschlüssel) ist eindeutig falsch rückübersetzt (턞):

import unicodedata as ucd
s = "𝄞턞"
for z in s:
    z, ord(z), ucd.name(z)

('𝄞', 119070, 'MUSICAL SYMBOL G CLEF')
('턞', 53534, 'HANGUL SYLLABLE TYAELM')


WB

[toc] | [prev] | [next] | [standalone]


#6158 — [Python-de] Fwd: Codepage-Methode und Basis 4096

FromErich Schnoor <eschnoor@multi-matrix.de>
Date2024-08-09 21:52 +0200
Subject[Python-de] Fwd: Codepage-Methode und Basis 4096
Message-ID<750068DF-8039-4958-8AA4-51719F520D11@multi-matrix.de>
In reply to#6157
Hallo, Herr Büchel,
Ja, bei der Eingabe wurde der Violinschlüssel “𝄞"
nicht erkannt. Jetzt die korrekte Rückübersetzung:
> 
 insert file >  ABCäöü߀𝄞
 inserted text
 ABCäöü߀𝄞
 <point>data 
 65 66 67 228 246 252 223 8364 119070 
 number of bytes 12

 <index>data 
 Ã Ä Å ŧ Ź ſ Ţ 2į tơ 
  sequence of <binary>data:
000000000100000100000000010000100000000001000011000000001110010000000000111101100000000011111100000000001101111100100000101011001101000100011110
                             Die Sendung erfolgt mit der Datei:  binfolge.bin :

Mit freundlichen Grüßen 
Erich Schnoor

> Anfang der weitergeleiteten Nachricht:
> 
> Von: Wolli Buechel über python-de <python-de@python.org>
> Betreff: [Python-de] Re: Fwd: Codepage-Methode und Basis 4096
> Datum: 9. August 2024 um 19:50:06 MESZ
> An: python-de@python.org
> Antwort an: Wolli Buechel <wjb131@web.de>
> 
>> hier die Rückübersetzung des Teststrings:  "ABCäöü߀𝄞”:
> 
>> ABCäöü߀턞
>> 
>> sequence of <index>data:
>> Ã Ä Å ŧ Ź ſ Ţ 2į dơ
> 
> Das letzte Zeichen (𝄞, Violinschlüssel) ist eindeutig falsch rückübersetzt (턞):
> 
> import unicodedata as ucd
> s = "𝄞턞"
> for z in s:
>    z, ord(z), ucd.name(z)
> 
> ('𝄞', 119070, 'MUSICAL SYMBOL G CLEF')
> ('턞', 53534, 'HANGUL SYLLABLE TYAELM')
> 
> 
> WB
> _______________________________________________
> python-de Mailingliste -- python-de@python.org
> Zur Abmeldung von dieser Mailingliste senden Sie eine Nachricht an python-de-leave@python.org
> https://mail.python.org/mailman3/lists/python-de.python.org/
> Mitgliedsadresse: eschnoor@multi-matrix.de

[toc] | [prev] | [next] | [standalone]


#6162 — [Python-de] Re: Fwd: Codepage-Methode und Basis 4096

From"Wolli Buechel" <wjb131@web.de>
Date2024-08-10 08:25 +0000
Subject[Python-de] Re: Fwd: Codepage-Methode und Basis 4096
Message-ID<172327831513.6477.15208711589102645910@mail.python.org>
In reply to#6158
> Ja, bei der Eingabe wurde der Violinschlüssel “𝄞"
> nicht erkannt. 

Wie kommt denn das?

[toc] | [prev] | [next] | [standalone]


#6163 — [Python-de] Fwd: Codepage-Methode und Basis 4096

FromErich Schnoor <eschnoor@multi-matrix.de>
Date2024-08-10 11:48 +0200
Subject[Python-de] Fwd: Codepage-Methode und Basis 4096
Message-ID<B700A949-CC61-48D5-9B40-A462C645E882@multi-matrix.de>
In reply to#6162
Ganz einfach!
Die Eingabe erfolgte über die Zwischenablage !
Dabei ist wohl das letzte Zeichen nur halb erfasst worden
Ist Ihnen das noch nie passiert?
mfg
Erich Schnoor

> Anfang der weitergeleiteten Nachricht:
> 
> Von: Wolli Buechel über python-de <python-de@python.org>
> Betreff: [Python-de] Re: Fwd: Codepage-Methode und Basis 4096
> Datum: 10. August 2024 um 10:25:15 MESZ
> An: python-de@python.org
> Antwort an: Wolli Buechel <wjb131@web.de>
> 
>> Ja, bei der Eingabe wurde der Violinschlüssel “𝄞"
>> nicht erkannt.
> 
> Wie kommt denn das?
> _______________________________________________
> python-de Mailingliste -- python-de@python.org
> Zur Abmeldung von dieser Mailingliste senden Sie eine Nachricht an python-de-leave@python.org
> https://mail.python.org/mailman3/lists/python-de.python.org/
> Mitgliedsadresse: eschnoor@multi-matrix.de

[toc] | [prev] | [next] | [standalone]


#6198 — [Python-de] Re: Fwd: Codepage-Methode und Basis 4096

From"Wolli Buechel" <wjb131@web.de>
Date2024-08-13 09:28 +0000
Subject[Python-de] Re: Fwd: Codepage-Methode und Basis 4096
Message-ID<172354133666.4256.4709255909313182862@mail.python.org>
In reply to#6163
> Ja, bei der Eingabe wurde der Violinschlüssel “𝄞"
> nicht erkannt.

< wie kommt denn das?

> Ganz einfach!
> Die Eingabe erfolgte über die Zwischenablage !
> Dabei ist wohl das letzte Zeichen nur halb erfasst worden.
> Ist Ihnen das noch nie passiert?

Da haben Sie aber eine extrem raffinierte Zwischenablage. Oder ist die bloß defekt?
Die liest sogar Bruchstücke (einzelne Bytes) von Mehr-Byte-Zeichen.
Oder etwa gar einzelne Nibbels? Am Ende sogar einzelne Bits?

Hoffentlich passiert Ihnen dieses Malheur nicht öfter. 
Das wäre für Ihre Programme gar nicht gut.

[toc] | [prev] | [next] | [standalone]


#6171 — [Python-de] Re: Fwd: Codepage-Methode und Basis 4096

From"Wolli Buechel" <wjb131@web.de>
Date2024-08-10 16:36 +0000
Subject[Python-de] Re: Fwd: Codepage-Methode und Basis 4096
Message-ID<172330780360.24688.2495688134725736758@mail.python.org>
In reply to#6158
>  ABCäöü߀𝄞
>  <point>data 
>  65 66 67 228 246 252 223 8364 119070 
>  number of bytes 12

Ihr Programm berechnet die Zahl der Bytes nicht korrekt.

Der String s = "ABCäöü߀𝄞" hat nicht 12 Byte, sondern 18 Byte:

ipython
Python 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:36:13) [GCC 12.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.26.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: s = "ABCäöü߀𝄞"

In [2]: [ ord(x) for x in s ]
Out[2]: [65, 66, 67, 228, 246, 252, 223, 8364, 119070]

In [3]: [ list(bytes(x, 'utf8')) for x in s ]
Out[3]: 
[[65],
 [66],
 [67],
 [195, 164],
 [195, 182],
 [195, 188],
 [195, 159],
 [226, 130, 172],
 [240, 157, 132, 158]]

In [4]: [ len(bytes(x, 'utf8')) for x in s ]
Out[4]: [1, 1, 1, 2, 2, 2, 2, 3, 4]

In [5]: sum([ len(bytes(x, 'utf8')) for x in s ])
Out[5]: 18

W. Büchel

[toc] | [prev] | [next] | [standalone]


#6173 — [Python-de] Fwd: Codepage-Methode und Basis 4096

FromErich Schnoor <eschnoor@multi-matrix.de>
Date2024-08-11 11:44 +0200
Subject[Python-de] Fwd: Codepage-Methode und Basis 4096
Message-ID<9982AF37-667D-4825-BA0D-A80F22D9E3CD@multi-matrix.de>
In reply to#6171
Hallo,  sg. Herr Büchel,
da muss ich noch an die nicht korrigierte Version gekommen sein.
Hier die letzte berichtigte Version:

                                                      data coding and sending
  1.  read data:
  2.  write data:
  3.  menue:
  chose position >      1 / 2 / 3   > 1

 insert file >  ABCäöü߀𝄞
 inserted text
 ABCäöü߀𝄞
                                                 sending <index>data
  sequence of  <index>data:
 Ã,Ä,Å,ŧ,Ź,ſ,Ţ,2į,tơ,
 sequence of <original>data:
 ABCäöü߀𝄞

  sequence of <binary>data: 000000000100000100000000010000100000000001000011000000001110010000000000111101100000000011111100000000001101111100100000101011001101000100011110
                             Die Sendung erfolgt mit der Datei:  binfolge.bin :

 Die <point>Zahlen des original Textes werden hier nicht mehr ausgegeben. Sie sind für die
kodierung auch nicht erforderlich, sondern nur noch für die Markierung auf der Tastatur.

mfg
Erich Schnoor

> Anfang der weitergeleiteten Nachricht:
> 
> Von: Wolli Buechel über python-de <python-de@python.org>
> Betreff: [Python-de] Re: Fwd: Codepage-Methode und Basis 4096
> Datum: 10. August 2024 um 18:36:43 MESZ
> An: python-de@python.org
> Antwort an: Wolli Buechel <wjb131@web.de>
> 
>> ABCäöü߀𝄞
>> <point>data 
>> 65 66 67 228 246 252 223 8364 119070 
>> number of bytes 12
> 
> Ihr Programm berechnet die Zahl der Bytes nicht korrekt.
> 
> Der String s = "ABCäöü߀𝄞" hat nicht 12 Byte, sondern 18 Byte:
> 
> ipython
> Python 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:36:13) [GCC 12.3.0]
> Type 'copyright', 'credits' or 'license' for more information
> IPython 8.26.0 -- An enhanced Interactive Python. Type '?' for help.
> 
> In [1]: s = "ABCäöü߀𝄞"
> 
> In [2]: [ ord(x) for x in s ]
> Out[2]: [65, 66, 67, 228, 246, 252, 223, 8364, 119070]
> 
> In [3]: [ list(bytes(x, 'utf8')) for x in s ]
> Out[3]: 
> [[65],
> [66],
> [67],
> [195, 164],
> [195, 182],
> [195, 188],
> [195, 159],
> [226, 130, 172],
> [240, 157, 132, 158]]
> 
> In [4]: [ len(bytes(x, 'utf8')) for x in s ]
> Out[4]: [1, 1, 1, 2, 2, 2, 2, 3, 4]
> 
> In [5]: sum([ len(bytes(x, 'utf8')) for x in s ])
> Out[5]: 18
> 
> W. Büchel
> _______________________________________________
> python-de Mailingliste -- python-de@python.org
> Zur Abmeldung von dieser Mailingliste senden Sie eine Nachricht an python-de-leave@python.org
> https://mail.python.org/mailman3/lists/python-de.python.org/
> Mitgliedsadresse: eschnoor@multi-matrix.de

[toc] | [prev] | [next] | [standalone]


#6178 — [Python-de] Re: Fwd: Codepage-Methode und Basis 4096

From"Wolli Buechel" <wjb131@web.de>
Date2024-08-11 15:22 +0000
Subject[Python-de] Re: Fwd: Codepage-Methode und Basis 4096
Message-ID<172338977357.21974.9105646292431030899@mail.python.org>
In reply to#6173
Hallo Herr Schnoor,

könnten Sie mir bitte diese korrigierte Programm-Version zuschicken.
Danke im Voraus.

W. Büchel

[toc] | [prev] | [next] | [standalone]


#6186 — [Python-de] Fwd: Codepage-Methode und Basis 4096

FromErich Schnoor <eschnoor@multi-matrix.de>
Date2024-08-11 19:06 +0200
Subject[Python-de] Fwd: Codepage-Methode und Basis 4096
Message-ID<B1E07CF5-53A8-41F2-A5A2-937180A3BD89@multi-matrix.de>
In reply to#6178
Hallo, sg. Herr Büchel,
in der Anlage - wie gewünscht - das Python-Programm 
“Codepage-univers.py” und Zusatzdatei: “Unicode-Blöcke.txt” als Kopie.

mfg
Erich Schnoor


> Anfang der weitergeleiteten Nachricht:
> 
> Von: Wolli Buechel über python-de <python-de@python.org>
> Betreff: [Python-de] Re: Fwd: Codepage-Methode und Basis 4096
> Datum: 11. August 2024 um 17:22:53 MESZ
> An: python-de@python.org
> Antwort an: Wolli Buechel <wjb131@web.de>
> 
> Hallo Herr Schnoor,
> 
> könnten Sie mir bitte diese korrigierte Programm-Version zuschicken.
> Danke im Voraus.
> 
> W. Büchel
> _______________________________________________
> python-de Mailingliste -- python-de@python.org
> Zur Abmeldung von dieser Mailingliste senden Sie eine Nachricht an python-de-leave@python.org
> https://mail.python.org/mailman3/lists/python-de.python.org/
> Mitgliedsadresse: eschnoor@multi-matrix.de



[toc] | [prev] | [next] | [standalone]


#6187 — [Python-de] Re: Fwd: Codepage-Methode und Basis 4096

From"Wolli Buechel" <wjb131@web.de>
Date2024-08-11 20:36 +0000
Subject[Python-de] Re: Fwd: Codepage-Methode und Basis 4096
Message-ID<172340856191.24690.7278656943094606510@mail.python.org>
In reply to#6186
Hallo Herr Schnoor,

danke für die Zusendung der Datei Codepage-univers.py. 
Diese Datei enthält allerdings keine Berechnung von Bytes, weder eine fehlerhafte noch eine korrekte.

Die zuvor übersandte Datei keyboard-coding-asia.py enthält jedoch eine solche Berechnung. 
Dort wird die Anzahl der Bytes eines Strings mittels der Funktion unit() bestimmt, und zwar so:

def unit(digit):             # --------------------- Analyse der Anzahl <bits> ---------------------
    # digit = Ordnungszahl ord(ch) eines UTF8-Zeichens ch (Einfügung von mir, WB)
    if digit < 256:
        byte = 1
    elif digit > 256 and digit < 65536:
        byte = 2
    elif digit > 65535 and digit <16777215:
        byte = 3
    elif digit > 16777215:
        byte = 4
    return byte

Wie dieser Python-Coder verrät, sind – oder waren – Sie offenbar davon überzeugt, dass für die Codierung der Codepoint-Nummer eines UTF8-Zeichens für jedes der möglichen 1/2/3/4 Bytes alle 8 Bit eines Bytes zur Verfügung stehen. (Für 1 Byte 2**8 = 256 Bit, für 2 Byte 2**16 = 65536 Bit, etc.) 

Dies ist jedoch nicht der Fall. Denn die Bytes enthalten – zusätzlich zur Codepoint-Nummer – noch einen Geheimcode (den Sie als Experte für Codierung – unbegreiflicherweise – nicht zu kennen scheinen). 
Dieser Geheimcode ist eine Markierung dafür, aus wie vielen Byte ein Zeichen besteht. 
Bei einem Ein-Byte-Zeichen beginnt dieses Solo-Byte mit einem 0-Bit. 
Ein Mehr-Byte-Zeichen besteht logischerweise aus einer Gruppe zusammengehöriger Bytes, 
einem sogenannten Start-Byte und ein oder mehreren Folge-Bytes: 
Das Start-Byte beginnt mit einer Folge von 1-Bits, deren Anzahl gleich der Anzahl der Folge-Bytes entspricht (11, 111, 1111 = 2,3,4 Folge-Bytes). 

In der folgenden Tabelle sind die Intervalle der Ordnungszahlen für 1/2/3/4 Bytes 
sowie die geheime Bit-Struktur des Codes dargestellt ( vgl. https://en.wikipedia.org/wiki/UTF-8#Encoding ):

Code point ↔ UTF-8 conversion
First code point		Last code point		Byte 1		Byte 2		Byte 3		Byte 4
U+0000		U+007F		0xxxxxxx
U+0080		U+07FF		110xxxxx	10xxxxxx
U+0800		U+FFFF		1110xxxx	10xxxxxx	10xxxxxx
U+010000		U+10FFFF		11110xxx	10xxxxxx	10xxxxxx	10xxxxxx

Aufgrund der Ordnung der Intervalle nach Byte-Anzahlen kann man nun aus der Ordnungszahl ord(ch) eines UTF8-Zeichens ch leicht seine Byteanzahl berechnen, etwa mit folgender Python-Funktion:

def getNumBytes(ch):
    "liefert die Anzahl der Bytes (1 bis 4) des UTF8-Zeichens ch via ord(ch)"
    MaxUTF8 = 1114111
    point = ord(ch)
    if point in range(0, 2**7): return 1
    elif point in range(2**8, 2**11): return 2
    elif point in range(2**11, 2**16): return 3
    elif point in range(2**16, 1 + MaxUTF8): return 4

Dieser Geheimcode ist doch clever gemacht von den Entwicklern der UTF8-Codierung der Unicode-Zeichen, oder?

W. Büchel

[toc] | [prev] | [next] | [standalone]


#6189 — [Python-de] Re: Fwd: Codepage-Methode und Basis 4096

From"Wolli Buechel" <wjb131@web.de>
Date2024-08-11 20:40 +0000
Subject[Python-de] Re: Fwd: Codepage-Methode und Basis 4096
Message-ID<172340883852.21974.11540442510204194184@mail.python.org>
In reply to#6187
Korrektur:

Das Start-Byte beginnt mit einer Folge von 1-Bits, deren Anzahl gleich der GESAMTZAHL der Bytes entspricht (11, 111, 1111 = 2,3,4 Bytes).

[toc] | [prev] | [standalone]


Back to top | Article view | de.comp.lang.python


csiph-web