Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > de.comp.lang.python > #6171

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

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From "Wolli Buechel" <wjb131@web.de>
Newsgroups de.comp.lang.python
Subject [Python-de] Re: Fwd: Codepage-Methode und Basis 4096
Date Sat, 10 Aug 2024 16:36:43 -0000
Lines 38
Message-ID <172330780360.24688.2495688134725736758@mail.python.org> (permalink)
References <750068DF-8039-4958-8AA4-51719F520D11@multi-matrix.de>
Mime-Version 1.0
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de 0VNnvGC9ikQTAi80+vZk9Q23EX7GcmCFtOczZ1+U3ZIw==
Cancel-Lock sha1:TPw+rbyytn07rRKuEQ+ZB6lFoBk= sha256:FHjYZvUANzqhrobPWwfCMSlJTR+9VpNVZ/OIEK5WLDo=
Authentication-Results mail.python.org; dkim=none reason="no signature"; dkim-adsp=none (unprotected policy); dkim-atps=neutral
In-Reply-To <750068DF-8039-4958-8AA4-51719F520D11@multi-matrix.de>
User-Agent HyperKitty on https://mail.python.org/
Message-ID-Hash GVTTCLTQXV2H2XM4ZEYRGRIWUTD3HV2E
X-Message-ID-Hash GVTTCLTQXV2H2XM4ZEYRGRIWUTD3HV2E
X-MailFrom wjb131@web.de
X-Mailman-Rule-Misses dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-python-de.python.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
X-Mailman-Version 3.3.10b1
Precedence list
List-Id Die Deutsche Python Mailingliste <python-de.python.org>
Archived-At <https://mail.python.org/archives/list/python-de@python.org/message/GVTTCLTQXV2H2XM4ZEYRGRIWUTD3HV2E/>
List-Archive <https://mail.python.org/archives/list/python-de@python.org/>
List-Help <mailto:python-de-request@python.org?subject=help>
List-Owner <mailto:python-de-owner@python.org>
List-Post <mailto:python-de@python.org>
List-Subscribe <mailto:python-de-join@python.org>
List-Unsubscribe <mailto:python-de-leave@python.org>
Xref csiph.com de.comp.lang.python:6171

Show key headers only | View raw


>  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

Back to de.comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

[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

csiph-web