Thread String manipulation (30 answers)
Opened by Haselnuss992 at 2018-10-15 15:39

Raubtier
 2018-10-17 13:44
#188982 #188982
User since
2012-05-04
1054 Artikel
BenutzerIn

user image
2018-10-17T11:16:12 rosti
Sobald Du den Layer auf utf-8 schaltest, geht Deine Lösung übrigens in die Hose.

Gerade nicht, sie funktioniert dann weiter. Das ist ja gerade, weswegen sie besser ist. Sie liest immer 160 Zeichen.

Edit: Beispiel:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[13:48:33] ~/test$ cat a
12345678901234567890äöüäöüäöüäöüäöüäöüäö
[13:48:39] ~/test$ hexdump -C a
00000000 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 |1234567890123456|
00000010 37 38 39 30 c3 a4 c3 b6 c3 bc c3 a4 c3 b6 c3 bc |7890............|
00000020 c3 a4 c3 b6 c3 bc c3 a4 c3 b6 c3 bc c3 a4 c3 b6 |................|
00000030 c3 bc c3 a4 c3 b6 c3 bc c3 a4 c3 b6 0a |.............|
0000003d
[13:48:42] ~/test$ perl -MEncode -wE'open my $FH, "<:utf8", "a" or die $!; my @entries = do { local $/ = \5; <$FH> }; say encode_utf8($_) for @entries;'
12345
67890
12345
67890
äöüäö
üäöüä
öüäöü
äöüäö

Last edited: 2018-10-17 13:55:23 +0200 (CEST)

View full thread String manipulation