How to output UTF-8 data from PHP for Flash

To use UTF-8 data in Flash you have to be sure to encode it right before sending the output.

Since Flash can’t handle these characters directly you have to serialise the data first, then escape the html and then url encode it.