aboutsummaryrefslogtreecommitdiffstats
path: root/mod/notification-email.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-12-04 09:44:32 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-12-04 12:08:47 +0100
commit84368ec6ebe758d4f7f5745bb1b8c48a292025bb (patch)
tree259cc30c3f6aee39051c622a21c8f61ca341d2eb /mod/notification-email.rsc
parent1bb2871e0badcbdf56605ccfd64e319e61556172 (diff)
mod/notification-email: $QuotedPrintable: minor rework
We have to encode all characters from 0x00 to 0x1f as well... Also the equal sign is nothing special here, just adding to list.
Diffstat (limited to 'mod/notification-email.rsc')
-rw-r--r--mod/notification-email.rsc21
1 files changed, 11 insertions, 10 deletions
diff --git a/mod/notification-email.rsc b/mod/notification-email.rsc
index 774af4c..76f198f 100644
--- a/mod/notification-email.rsc
+++ b/mod/notification-email.rsc
@@ -170,27 +170,28 @@
:global QuotedPrintable do={
:local Input [ :tostr $1 ];
+ :global CharacterMultiply;
+
:if ([ :len $Input ] = 0) do={
:return $Input;
}
:local Return "";
- :local Chars ("\80\81\82\83\84\85\86\87\88\89\8A\8B\8C\8D\8E\8F\90\91\92\93\94\95\96\97" . \
- "\98\99\9A\9B\9C\9D\9E\9F\A0\A1\A2\A3\A4\A5\A6\A7\A8\A9\AA\AB\AC\AD\AE\AF\B0\B1\B2\B3" . \
- "\B4\B5\B6\B7\B8\B9\BA\BB\BC\BD\BE\BF\C0\C1\C2\C3\C4\C5\C6\C7\C8\C9\CA\CB\CC\CD\CE\CF" . \
- "\D0\D1\D2\D3\D4\D5\D6\D7\D8\D9\DA\DB\DC\DD\DE\DF\E0\E1\E2\E3\E4\E5\E6\E7\E8\E9\EA\EB" . \
- "\EC\ED\EE\EF\F0\F1\F2\F3\F4\F5\F6\F7\F8\F9\FA\FB\FC\FD\FE\FF");
- :local Hex { "0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "A"; "B"; "C"; "D"; "E"; "F" };
+ :local Chars ( \
+ "\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\10\11\12\13\14\15\16\17\18\19\1A\1B\1C\1D\1E\1F" . \
+ [ $CharacterMultiply ("\00") 29 ] . "=" . [ $CharacterMultiply ("\00") 65 ] . "\7F" . \
+ "\80\81\82\83\84\85\86\87\88\89\8A\8B\8C\8D\8E\8F\90\91\92\93\94\95\96\97\98\99\9A\9B\9C\9D\9E\9F" . \
+ "\A0\A1\A2\A3\A4\A5\A6\A7\A8\A9\AA\AB\AC\AD\AE\AF\B0\B1\B2\B3\B4\B5\B6\B7\B8\B9\BA\BB\BC\BD\BE\BF" . \
+ "\C0\C1\C2\C3\C4\C5\C6\C7\C8\C9\CA\CB\CC\CD\CE\CF\D0\D1\D2\D3\D4\D5\D6\D7\D8\D9\DA\DB\DC\DD\DE\DF" . \
+ "\E0\E1\E2\E3\E4\E5\E6\E7\E8\E9\EA\EB\EC\ED\EE\EF\F0\F1\F2\F3\F4\F5\F6\F7\F8\F9\FA\FB\FC\FD\FE\FF");
+ :local Hex "0123456789ABCDEF";
:for I from=0 to=([ :len $Input ] - 1) do={
:local Char [ :pick $Input $I ];
:local Replace [ :find $Chars $Char ];
- :if ($Char = "=") do={
- :set Char "=3D";
- }
:if ([ :typeof $Replace ] = "num") do={
- :set Char ("=" . ($Hex->($Replace / 16 + 8)) . ($Hex->($Replace % 16)));
+ :set Char ("=" . [ :pick $Hex ($Replace / 16)] . [ :pick $Hex ($Replace % 16) ]);
}
:set Return ($Return . $Char);
}