Escape colons and exclamation characters

I’m using amfphp to bring data into flash and assign it to my textfield.text. Everything works great except colons or exclamation points won’t show up in the dynamic textfield. All of the rest of the string show up but if the string contains these characters they are simply skipped. There are probably more characters that won’t show up but I have only ran into these two.

Is there some character escape function I can use to handle special characters? Any help would be appreciated