The html text following:
<script type="text/javascript">alert(123);</script>
<script>alert(123);</script>
As mentioned above, only part of html text was escaped.
Now, I want to escape the text: <script>alert(123);</script>
.
Expected result:
<script type="text/javascript">alert(123);</script>
<script>alert(123);</script>
I need some help.
Escaping in HTML means, that you are replacing some special characters with others. In HTML it means usally, you replace e. e.g < or > or " or & . These characters have special meanings in HTML. And the text will appear as hello, world.
There's EscapeString function in html package
unescaped := `<script>alert(123);</script>`
escaped := html.EscapeString(unescaped)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With