MQTT core implementation compliance

Hi all,
according to MQTT specifications v3.1 here and v.3.1.1 here the MQTT protocol includes

A messaging transport that is agnostic to the content of the payload.

At the moment, the HA MQTT core implementation is not agnostic to the content of the payload, because it treats any payload as an UTF-8 encoded string, which means we cannot send or receive binary payloads such as pictures, small videos and files in general.

A possible workaround is to base64 encode the payload before sending it.

In the effort to make the HA MQTT core compliant (and to make it interoperable with third party applications like this here), I tried to modify it with the PR here, but I don’t seem to get it right.

Any thoughts? Suggestions?

thanks
gl