I'm using an RTF converter and I need 240 as &#U050&#U052&#U048 but Im not to sure how to do this!?!
I have tried using the following function:
function string_to_ascii($string) {
$ascii = NULL;
for ($i = 0; $i < strlen($string); $i++) {
$ascii += "&#U"+str_pad(ord($string[$i]),3,"0",STR_PAD_LEFT);
}
return($ascii);
}
But it still just outputs just the number (e.g. 2 = 50) and ord just makes it go mad.
I've tried echo "-&#U"+ord("2")+"-"; and I get 50416 !?!?
I have a feeling it might have something to do with encoding
&#U050is not ASCII. It's an XML/HTML numeric entity, using unicode encoding. Anyway, what kind of insane software needs plain text characters to be entity encoded like that?©. And other examples seem to use plain text. As I say I've not used it, so if it really does need all that encoding then so be it, but I'd be very surprised.£I have to use&#U163. It then won't let me use numbers or letters after it (I suppose till it hits a space). So240becomes&#U050&#U052&#U048:(&#U163;. That's how it knows it's finished the entity. Add a semi-colon to the end of your entities, and it let you use numbers and letters after it just fine.