> -----Original Message----- > From: Klaus Ethgen > Sent: Saturday, December 31, 2016 08:48 > To: Willi Mann > Cc: Jason Pyeron; 849...@bugs.debian.org; logwatch-de...@lists.sourceforge.net > > Hi, > > Am Sa den 31. Dez 2016 um 14:28 schrieb Willi Mann: > > thanks for your test cases. However, I don't think that > binmode provides > > an acceptable solution, at least not alone. While it > ensures that the > > strings are valid utf-8 strings, it will convert any valid utf-8 > > character to two "garbage" characters. Try
Not exactly a valid test, besides it works for me. The issue is internal ascii data being written as ascii but instructing consumers it is uft8. $ cat utf8_test.pl #!/usr/bin/perl # use strict; use File::Slurp; my $inputfile = @ARGV[0]; my $logfilecontent = read_file($inputfile); binmode(STDOUT, ":utf8"); print $logfilecontent; $ ./utf8_test.pl testlog.txt übersät $ ./utf8_test.pl testlog.txt | hexdump -C 00000000 c3 bc 62 65 72 73 c3 a4 74 0a |..bers..t.| 0000000a $ hexdump.exe -C testlog.txt 00000000 fc 62 65 72 73 e4 74 0a |.bers.t.| 00000008 > > Well, that "garbage" is by design for UTF-8. If you don't want that, > stay on latin1. > > It is a no-go to set the mime type to UTF-8 but still send latin1. (As > it does the current version.) Setting header to UTF-8 doesn't > change the > content of the mail. It just open up for troubles. > > Regards > Klaus > - -- > Klaus Ethgen > http://www.ethgen.ch/ > pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen > <kl...@ethgen.ch> > Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C > -----BEGIN PGP SIGNATURE----- > Comment: Charset: ISO-8859-1 > > iQGzBAEBCgAdFiEEMWF28vh4/UMJJLQEpnwKsYAZ9qwFAlhntxMACgkQpnwKsYAZ > 9qyD4gv/ThmNQDCI9QeXYGvwafNDzcDtaHUpeGhOqJI4NjE/UxvPDGIJsMAmS3fI > w69zDuHmy9d1AsCm4I8ipF9l1LD1GHo8Fh9g2Uiv4l6d5e4jYmMi/L/pJxqbAqIt > A1LjNQUNGMLk97OHLqR5/9lnfOzahdzgEVNP/Fi5ygVXi3vJFdwfFFbWk39CfYUy > jcKQUdDzbQUzyFLl7I+1pZm19HCDH4v5fIzqwQW8bz4VXpTIUZjXJSV2n5gN1Lo9 > 99utKdR1b1UQScdGs2zV/QhVN/IJJsNNzK4Zylisdjw0ZgvnSW3gt461d62FAH1o > R4UwerUZYWzCGLZHpGwPw/1/s7YOAlPlO46UzSslqC0J0mmcCPG5eBz4iX2F03U3 > uoz3gscPsjFAf/eqlkp6MHXeNqSV2cCwQLnqZ17/py5DiMUxS61dFXRmcrLOotC0 > KmDBRC7Gft8dcr4bjqYG3jIv0ppOEdvA1izQQ+q2WNQ4E7AprDPJ94MgibQ8BBYX > iGbaxnj2 > =af5+ > -----END PGP SIGNATURE----- >