You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can see the Replace function is called on the Body variable which contains the HTML body.
Accents (and others non-ascii characters) are usually html-encoded to avoid rendering issue.
We can quickly see this is indeed the case here when looking at the raw HTML output:
The solution would be to html-encode the color/style values before trying to replace them in the HTML body.
Workaround
For a simple workaround, simply drop these two lines before calling Start-ADReporting (assuming the formatting options are in the $FormattingParameters variable):
It simply iterates over all colors/styles values and html-encode them.
(Note that I left the HtmlDecode in case somebody run these lines multiple time)
With that, the colors and styles are now working 😸
The text was updated successfully, but these errors were encountered:
Tested on the Legacy script (V1). I didn't test on the V2 version.
For a workaround, see below.
If a formatting value (be it for color or style) is using accent or other non-ascii characters, then the color or style won't be applied.
Since event log are localized, accented characters can appeared in the report (French in our case).
Given a formatting option below:
It does not highlight the word:
The issue is not linked to the file encoding, as UTF8-BOM is used and the accent is correctly encoded as we can see in the log:
The issue is related to the way the replace function is actually called:
PSWinReporting/Private/PSWinReportingEmails.ps1
Lines 62 to 64 in 36089a8
We can see the
Replace
function is called on theBody
variable which contains the HTML body.Accents (and others non-ascii characters) are usually html-encoded to avoid rendering issue.
We can quickly see this is indeed the case here when looking at the raw HTML output:
The solution would be to html-encode the color/style values before trying to replace them in the HTML body.
Workaround
For a simple workaround, simply drop these two lines before calling
Start-ADReporting
(assuming the formatting options are in the$FormattingParameters
variable):It simply iterates over all colors/styles values and html-encode them.
(Note that I left the HtmlDecode in case somebody run these lines multiple time)
With that, the colors and styles are now working 😸
The text was updated successfully, but these errors were encountered: