Replace line breaks from Textinput with <br> in dashboard

Product: PowerShell Universal
Version: 3.8.8

Hi guys,
it’s me again.

I have a multi line textinput in a Form in a Dashboard. When I submit the form I get the text from the text input. So far so good. Now I’d like to replace all New Lines with
because I will use that text to send out an E-Mail. If I don’t do this, the line breaks the user has placed via ENTER on his keyboard won’t get passed through to the E-Mail, because E-Mail is HTML and this textbox uses something else.

My Textinput:

New-UDTextbox -Id 'txtMessage' -Label 'Message' -Placeholder 'Your message including >Hello...< and >Kind regards...<' -Multiline -Rows 4 -RowsMax 10 -FullWidth

I tried:

$text = $EventData.txtMessage
$text = $text.replace([System.Environment]::NewLine, "<br>")
$text = $text.replace('`n', "<br>")

Any ideas?

Try replacing <br> with <br />.

Thanks, I tried that already. No luck. The content of the submitted text field in BASE64 encoded is the following:

When converting this BASE64 to UTF8 (Convert Base64 to UTF8 - Online UTF8 Tools) and then pasting that into this handy tool which shows all UTF control characters (View non-printable unicode characters) shows me that each line ends with CL RF. I tried this article Powershell : Replace new line and tabs in a string with nothing or comma but it didn’t work either. These textboxes are very strange I must say.

Edit: Found the solution! You gotta do this:
Can’t paste the text as the forum software doesn’t like that.