Unable to set HTML field of a SugarBean

On my custom endpoint that does not require authentication I am trying to save an HTML string to a custom HTML field.

Outputting the HTML string to a TextArea field shows that it is definitely working and the string is correct.

In the screenshot below I have concatenated two versions of the HTML string - one with utf8_decode();  and the other (after the "\n\n----------\n\n", I thought TextArea would add newlines, ignore that please) as the plain string as I was checking whether it was received as Unicode.

I am trying to set the value of the HTML field in the same way as the TextArea, but it is not working. How am I supposed to do it?