]> git.proxmox.com Git - pmg-api.git/commit
utils: return perl string from decode_rfc1522
authorStoiko Ivanov <s.ivanov@proxmox.com>
Thu, 24 Nov 2022 12:21:01 +0000 (13:21 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 24 Nov 2022 13:38:44 +0000 (14:38 +0100)
commit15fcd85c2a0c6fe310c25b9eaa96f2aeff1293a9
treee778201e69dac362e59d82c17f894eeb02d5852b
parent0020a3c499e437ccf117897e4c68d8f5957858a4
utils: return perl string from decode_rfc1522

decode_rfc1522 is a more robust version of decode_mimewords (in
scalar context) - adapt it to return a perlstring, under the
assumption that data is utf-8 encoded (holds true for ascii and
smtputf8 mails)

the try_decode_utf8 helper sub backwards will be used extensively in
later patches and is inspired by commit
43f8112f0bb424f99057106d57d32276d7d422a6 in pve-storage:
We consider that the valid multibyte utf-8 characters do not really
yield sensible combinations of single-byte perl characters (starting
with a byte > 127 - e.g. "£") so if something decodes without error
from utf-8 it will in all likelyhood have been utf-8 to begin with

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PMG/Utils.pm