Sending Alarm text to email

Can somebody explain to me, please, why this isn’t working:

I have (test for now) tag with alarm defined with EU characters (šđčćž ŠĐČĆŽ):

In the Tag Event/Alarm Active I have:

and my shared script is this:

When I set alarm (tag to true) active, I get an error:

but if I remove time (today), the mail gets send OK…

and this is what I get in my email:

Very strange error. The error also mentions line 10, where only the final part of the body is added. And the message itself is about being unable to parse 0x61 to utf-8, while that should be simply the lowercase “a” in utf-8… which isn’t present in that line

Could you perhaps try with %s replacements?

That line 10 is, in fact, line 9… the pictures get mixed up when I was trying all sort of things…

But I think I found the solution:

body += alarmName.encode("utf-8")

I hate encodings and Unicode and … :rage:

1 Like

This makes more sense, as š is the first non-ASCII character of that string, on position 16.

The original encoding is probably UTF-16, as it complains about 0x61, which is part of the UTF-16 encoding of that character: 0x0161 http://graphemica.com/š

though it’s still strange it only mentions 0x61 and crashes on it. I’d expect that it would crash on 0x01, or give some garbled up text like usual.