Decode Base64 in character set windows-1250

Hello,
I need some advice on decoding base64 data. I have a template sensor that stores the text of a mail using IMAP integration. This sensor value is in base64. I am unable to decode it using base64_decode because the base64 text content is in windows-1250 character set and homeassistant uses UTF-8. Is there any simple solution to solve this problem?
Thank you for your help.