While making animated graphics through mobile phone, I take a string and make it look like it's being typed out. To do this, I take a substring from 0 to i and create the graphic with that substring. At the end, put all the graphics together and I have the animation.
for ($i=1;$i<=strlen($text);$i++) {
$frame++; //advance frame number
$result = create_frame("$image_url".urlencode(substr($text,0,$i)),$filename."-$frame");
if (!$result) return array("",false); else $results[] = $result;
}
This works perfectly fine for most people. For me, it even works with characters with umlauts, accents, and the like. However, a Danish user complained that before each "special" character, there appeared an extra character. It seems to always be an A with a tilde over it. See the slow-motion sample attached.
I figure this has to do with the way I am taking the substrings. If I take two characters at a time, this works on the Danish mobile, but only displays every other character for most mobiles.
So how do I determine whether I need to take one or two characters at a time? Or is there a better way to take the substrings?