Forum Discussion

jmckay321's avatar
jmckay321
Copper Contributor
Mar 29, 2022

Specify a character set when creating HTML message with Graph

I have an application that creates messages in Microsoft M365 using the Graph API. I use the "body" element with sub-properties "contentType" and "content" to specify the text of the message. When contentType is HTML, the HTML that goes into content is not made by my application, rather it is transferred from an external source, and I don't attempt to modify it in any way. The problem I'm having with one specific message is that it is encoded in ISO-8859-1 instead of UTF8, and M365 will not display the non-English characters correctly. The HTML itself has a META tag that specifies the character set:

META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">

And in fact this HTML body looks fine when displayed by itself in a browser window, it's just M365 that screws up the rendering. Is there I way I can tell Graph or M365 what the character set is for this property?

No RepliesBe the first to reply

Resources