From 162c5aefda09d58b100e5772b29303d61077b0a5 Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Mon, 2 Feb 2026 19:11:17 +0100 Subject: [PATCH 1/2] Left-align votetaker in all forms. Signed-off-by: Thomas Hochstein --- templates/address-not-registered | 2 +- templates/ballot-personal | 2 +- templates/bdsg-error | 2 +- templates/cancelled | 2 +- templates/invalid-account | 2 +- templates/invalid-name | 2 +- templates/multiple-votes | 2 +- templates/no-ballot | 2 +- templates/no-ballotid | 2 +- templates/no-votes | 2 +- templates/rule-violated | 2 +- templates/wrong-ballotid | 2 +- templates/wrong-voting | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/templates/address-not-registered b/templates/address-not-registered index f12ae79..05736fb 100644 --- a/templates/address-not-registered +++ b/templates/address-not-registered @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom head := value head | quote "> " body := value body | quote "> " diff --git a/templates/ballot-personal b/templates/ballot-personal index 495baec..c64230c 100644 --- a/templates/ballot-personal +++ b/templates/ballot-personal @@ -10,7 +10,7 @@ bdsginfo := value bdsginfo | create-lines 72 bdsgtext-first := value bdsgtext | first-words 50 bdsgtext-more := value bdsgtext | drop-words 50 | create-lines 50 -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom == TEMPLATE ================================================================= diff --git a/templates/bdsg-error b/templates/bdsg-error index bd44741..236728a 100644 --- a/templates/bdsg-error +++ b/templates/bdsg-error @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom == TEMPLATE ================================================================= Zur Wertung deiner Stimme ist die Zustimmung zur Speicherung, diff --git a/templates/cancelled b/templates/cancelled index 07cb9b2..cb28607 100644 --- a/templates/cancelled +++ b/templates/cancelled @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom == TEMPLATE ================================================================= Diese automatische Nachricht wurde dir nach Erhalt Deiner ANNULLIERUNG diff --git a/templates/invalid-account b/templates/invalid-account index 909dc01..ac1fe1e 100644 --- a/templates/invalid-account +++ b/templates/invalid-account @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom head := value head | quote "> " body := value body | quote "> " diff --git a/templates/invalid-name b/templates/invalid-name index ce7a28d..db3320b 100644 --- a/templates/invalid-name +++ b/templates/invalid-name @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom head := value head | quote "> " body := value body | quote "> " diff --git a/templates/multiple-votes b/templates/multiple-votes index d56b3ec..ba9ba9e 100644 --- a/templates/multiple-votes +++ b/templates/multiple-votes @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom body := value body | quote "> " == TEMPLATE ================================================================= diff --git a/templates/no-ballot b/templates/no-ballot index 4a2b71e..f6f737c 100644 --- a/templates/no-ballot +++ b/templates/no-ballot @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom body := value body | quote "> " == TEMPLATE ================================================================= diff --git a/templates/no-ballotid b/templates/no-ballotid index 2628944..c13d283 100644 --- a/templates/no-ballotid +++ b/templates/no-ballotid @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom head := value head | quote "> " body := value body | quote "> " diff --git a/templates/no-votes b/templates/no-votes index 1a6de00..f24d86d 100644 --- a/templates/no-votes +++ b/templates/no-votes @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom body := value body | quote "> " == TEMPLATE ================================================================= diff --git a/templates/rule-violated b/templates/rule-violated index ef95b33..095079c 100644 --- a/templates/rule-violated +++ b/templates/rule-violated @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom body := value body | quote "> " == TEMPLATE ================================================================= diff --git a/templates/wrong-ballotid b/templates/wrong-ballotid index 0eb49f7..f8a41d0 100644 --- a/templates/wrong-ballotid +++ b/templates/wrong-ballotid @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom head := value head | quote "> " body := value body | quote "> " diff --git a/templates/wrong-voting b/templates/wrong-voting index f233b7d..7d1c6e8 100644 --- a/templates/wrong-voting +++ b/templates/wrong-voting @@ -1,4 +1,4 @@ -votetaker := value mailfrom | fill-left 65 +votetaker := value mailfrom body := value body | quote "> " == TEMPLATE ================================================================= From a60ea76fe88a596c5e321809c8f79431dedaa9db Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Sun, 8 Feb 2026 15:06:05 +0100 Subject: [PATCH 2/2] Convert Usevote to UTF-8. Signed-off-by: Thomas Hochstein --- UVreadmail.pm | 11 +++++++++++ UVsendmail.pm | 4 +++- UVtemplate.pm | 12 +++++++----- templates/mailheader | 2 +- uvbounce.pl | 2 ++ uvcfv.pl | 2 ++ uvcount.pl | 2 ++ uvvote.pl | 3 +++ 8 files changed, 31 insertions(+), 7 deletions(-) diff --git a/UVreadmail.pm b/UVreadmail.pm index 0a1f98f..1ac4865 100644 --- a/UVreadmail.pm +++ b/UVreadmail.pm @@ -3,9 +3,12 @@ package UVreadmail; +use utf8; +use open qw(:std :encoding(UTF-8)); use strict; use UVconfig; use UVmessage; +use Encode qw(decode :fallbacks); use MIME::QuotedPrint; use MIME::Base64; use MIME::Parser; @@ -200,6 +203,7 @@ sub process { # extract address and name my $from = $head->get('From') || ''; + utf8::decode($from); # fix double encoding if ($from =~ /\s*([^<]\S+\@\S+[^>]) \((.+)\)/) { ($voter_addr, $voter_name) = ($1, $2); @@ -240,6 +244,13 @@ sub process { $body = $entity->stringify_body; } + # body: charset conversion to Perl internal representation + my $ct = $head->get('Content-Type') || ''; + if ($ct =~ /^text\/plain;.*charset=\"?([-a-zA-Z0-9]+)\"?/i) { + my $charset = $1; + $body = decode($charset, $body, FB_CROAK); + } + my $h_date = $head->get('Date') || ''; chomp $h_date; diff --git a/UVsendmail.pm b/UVsendmail.pm index a773733..e306a21 100644 --- a/UVsendmail.pm +++ b/UVsendmail.pm @@ -3,6 +3,8 @@ package UVsendmail; +use utf8; +use open qw(:std :utf8); use strict; use UVconfig; use UVtemplate; @@ -239,7 +241,7 @@ sub mimeencode { $word =~ s/\n//g; my $encword; if ($word =~ /[\x7F-\xFF]/) { - $encword = MIME::Words::encode_mimeword($word, 'Q', 'ISO-8859-1'); + $encword = MIME::Words::encode_mimeword($word, 'Q', 'UTF-8'); } elsif (length($word) > 75) { $encword = MIME::Words::encode_mimeword($word, 'Q', 'us-ascii'); } else { diff --git a/UVtemplate.pm b/UVtemplate.pm index 35f28db..c592987 100644 --- a/UVtemplate.pm +++ b/UVtemplate.pm @@ -44,6 +44,8 @@ einer Liste immer 60 Zeichen lang ist um ansehnliche Tabellen auszugeben. #---------------------------------------------------------------------- +use utf8; +use open qw(:std :utf8); use strict; use vars qw( $VERSION $functions @dirs); use UVconfig; @@ -370,10 +372,10 @@ sub _parse_rules{ sub _strip_chars{ my $line = $_[0] || return; - # führenden whitespace entfernen + # führenden whitespace entfernen $$line =~ s/^\s+//; - # kommentare bis zum nächsten Zeilenumbruch entfernen + # kommentare bis zum nächsten Zeilenumbruch entfernen $$line =~ s/^#.*$//m; } @@ -618,8 +620,8 @@ sub _parse_comment{ my $count = 1; while($string && $count) { - $string =~ s/^[^\[\]\\]+//s; # alles außer Klammern und Backslash wegwerfen - $string =~ s/^\\.//; # alles gesperrte löschen + $string =~ s/^[^\[\]\\]+//s; # alles außer Klammern und Backslash wegwerfen + $string =~ s/^\\.//; # alles gesperrte löschen $count++ if $string =~ s/^\[//; $count-- if $string =~ s/^\]//; @@ -775,7 +777,7 @@ Sonderzeichen oder Leerzeichen uebergeben werden muessen diese gequotet werden. Dazu kann ' also auch " verwendet werden. Die Funktionen geben im Allgemeinen einen String zurueck. Im Rahmen -von Listen können auch Arrays uebergeben werden. +von Listen können auch Arrays uebergeben werden. Die erste Funktion duerfte ueblicherweise 'value' sein. Sie gibt den des angegeben Schluessel zurueck, der dann von den folgenden Funktionen diff --git a/templates/mailheader b/templates/mailheader index 93746ba..684abbc 100644 --- a/templates/mailheader +++ b/templates/mailheader @@ -12,5 +12,5 @@ Message-ID: [$msgid] Date: [$date] X-Automated-Message: generated by [$usevote-version] MIME-Version: 1.0 -Content-Type: text/plain; charset\=iso-8859-1 +Content-Type: text/plain; charset\=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/uvbounce.pl b/uvbounce.pl index 0a7352f..44dfc1a 100755 --- a/uvbounce.pl +++ b/uvbounce.pl @@ -21,6 +21,8 @@ # written in C). Not all functions of Usevote/UseVoteGer 3.x are implemented! ############################################################################### +use utf8; +use open qw(:std :utf8); use strict; use Getopt::Long; use FindBin qw($Bin); diff --git a/uvcfv.pl b/uvcfv.pl index 5f09080..ee12b54 100755 --- a/uvcfv.pl +++ b/uvcfv.pl @@ -20,6 +20,8 @@ # written in C). Not all functions of Usevote/UseVoteGer 3.x are implemented! ############################################################################### +use utf8; +use open qw(:std :utf8); use strict; use Getopt::Long; use Digest::MD5 qw(md5_hex); diff --git a/uvcount.pl b/uvcount.pl index 4af9a8f..0e14c3e 100755 --- a/uvcount.pl +++ b/uvcount.pl @@ -20,6 +20,8 @@ # written in C). Not all functions of Usevote/UseVoteGer 3.x are implemented! ############################################################################### +use utf8; +use open qw(:std :encoding(UTF-8)); use strict; use Getopt::Long; use Digest::MD5 qw(md5_hex); diff --git a/uvvote.pl b/uvvote.pl index 7f23a42..c629b20 100755 --- a/uvvote.pl +++ b/uvvote.pl @@ -21,6 +21,8 @@ # written in C). Not all functions of Usevote/UseVoteGer 3.x are implemented! ############################################################################### +use utf8; +use open qw(:std :utf8); use strict; use Getopt::Long; use Text::Wrap qw(wrap $columns); @@ -330,6 +332,7 @@ sub process_vote { $voter_name = $3; $voter_name =~ s/^\s+//; # strip leading spaces $voter_name =~ s/\s+$//; # strip trailing spaces + utf8::decode($voter_name); # fix double encoding } if ($voter_name) {