View Full Version : mixing character-sets in Flash (using UTF-8)

03-07-2005, 11:38 AM
Dynamic text will not show properly when mixing encodings.

Need to:
- text sits UTF-8 formatted in database, pulled out with urlencode();
- I need to display Arabic dynamic text alongside European in Flash.
Wish to:
- I'd like to mix European and Arabic text in one TextField;
- I'd like to embed fonts to have control over how it looks.

What I have so far (http://antenna-men.xs4all.nl/TEST/arabisch.html) (the text you see is in one TextField)

The blocked characters are european text inside arabic. As if Geeza Pro does not have 123 etc., but the export report says those characters where exported ...???

download zip (http://antenna-men.xs4all.nl/TEST/arabisch.zip) (the text you see is in one TextField)

What am i doing wrong?

03-22-2005, 12:11 AM
I once had the same problem but with an embedded font. You have to precise those characters in the "character" panel.

Example if you have embedded the arabic font (only with the arabic glyphs) you will need to embed also the latin chars.

if this was not the problem, there is, it seems another issue, that to UTF8_encode a string in PHP, in some special cases one should use another function. you can read the users comments about that in www.php.net
in the page about utf8_encode

03-22-2005, 11:06 AM
thanks for the reply -*finally*-, but the problem is not embedding the font in general (as you can see on the first link of my post), but more specifically gettting the Western-European characters and Numerics to be displayed correctly in Flash's Arabic text-bit.

Don't really think it's an PHP solvable encoding-issue, but please tell me if I should think again ;)

While writing this, and re-reading my post. I think maybe the urlencode is my trouble, so:
LoadVars.onData might bring me a solution by pulling in the raw-data ... let y'all know what happens ...

03-22-2005, 01:47 PM
I have built a lot of multilanguage font applications, and my experience of it so far, is that Macromedia do not support anything as complex as this yet, although they seem to claim to.

If it is a database problem, then when you trace out the text received from the database, then it should have the boxes as well. But by the sounds of it, it does not seem to be an encoding problem, or there would be alot more errors in the text.

As 2 individual textboxes, with the correct character sets embedded in each, this should in theory display fine, but this takes the dynamic nature away from it slightly.

I have had other problems with this kind of situation, for example, when trying to mask dynamically-created text such as this. This causes the text not to display properly.

Flash also has a limit to the size of the character set it can embed in a file, so that if you wanted a truly multilingual SWF, you would not be able to do this in a single file (ie, with all the Latin, Cyrillic, Greek, Aarabic, and Asian characaters sets).

I have found that embedding the font for only certain character sets sometimes get round problems like this, for example, just the latin sets and not the arabic, or vice versa. Then you have to hope that the machine the client views it on has the correct character encoding settings ont heir machine.

I guess testing it on a couple of machines with different encoding settings and language settings would be a good start fo checking this out

03-23-2005, 04:27 PM
thanks for your *encouraging* reply ;) This was exactly what I feared to hear.
Well, one wise thing to do seems to dynamically load one-character-set swf's where text is needed :(.

Another thing I noticed that their's some automatic behaviour in Flash text embedding:
When a textfield contains arabic encoded text, the font is set to Verdana and set to embed arabic char-set, I'll find Verdana and Geeza Pro in the export report (Geeza Pro is never defined, but automatcally assigned ... :confused:
Then you have to hope that the machine the client views it on has the correct character encoding settings ont heir machine.I don't see how this would affect Flash if I send the correct headers in the html/php-environment ... care to explain?

Thanks so far!

03-24-2005, 10:58 AM
by that I mean that their locale settings for the client machine are set up to view particular character sets properly, and not display just boxes, question marks or blank spaces (ie. default character encodings for the intended characters)

04-12-2005, 02:28 PM
here's something else I've found, which is not very encouraging. Sounds like you need to fiddle with the registry, but I haven't got this work with programmatically created text yet


04-14-2005, 07:47 PM
that looks like a nice link badlorry, but it's rather difficult to hack the registry on a Mac ;) plus i've a feeling it's more-or-less against the (presumed) unicode capability of Flash to dig up these codepages ... that's what I thought we were rid of with MX!

I just stumbled across a tute by sephiroth (http://sephiroth.it/tutorials/flashPHP/specialChars) that should tell us what's up with flash and unicode. Alessandro is very experienced in Flash and is doing a unicode AS-editor ... so he should know what he's talking about. Haven't tested yet, but looks promising!