[swx] Foreign characters with swx
Aral Balkan
aral at aralbalkan.com
Wed Dec 12 04:32:42 PST 2007
Can some people affected by this issue please test Fabrício's code.
It would be great if we could get some test cases for this.
And I can include it in the next release once we're sure it's stable.
Thanks,
Aral
On Dec 12, 2007 11:02 AM, Fabrício Seger Kolling <dulldusk at gmail.com> wrote:
> To get foreign characters working I utf8_encode all strings on the
> function call result, before generating the swf file.
> Here's the function that I added to swxCompiler.php
>
> function fixData($data){
> // Assoc Array to Object
> // UTF8 Encode Strings
> // Fix Line Breaks
> if (is_array($data)) {
> reset($data);
> $k = key($data);
> if (strlen($k)==0){
> return $data;
> } elseif ($k !== intval($k)) {
> $data = (object)$data;
> return $this->fixData($data);
> } else {
> $d = Array();
> foreach ($data as $key => $val) {
> $d[$key] = $this->fixData($val);
> }
> return $d;
> }
> } elseif (is_object($data)) {
> $d = new stdClass();
> foreach ($data as $key => $val) {
> $d->{$key} = $this->fixData($val);
> }
> return $d;
> } elseif (is_string($data)) {
> return utf8_encode($this->fixLineBreaks($data));
> } else {
> return $data;
> }
> }
>
> function fixLineBreaks($str){
> // Prevent CRLF from resulting 2 line breaks on Flash multiline
> TextFields
> // CRLF -> LF
> // CR -> LF
> if (strpos($str, chr(13)) !== false) {
> $str = str_replace(chr(13), chr(10), str_replace(chr(13).chr(10),
> chr(10), $str));
> }
> return $str;
> }
>
> Fabrício Seger Kolling
>
> <fabricio at esmeril.com.br>
> ben wrote:
>
> That sounds more like a Flash issue than a swx issue...
>
> Some pointers
>
> I don't know how you're "showing" the characters in your flash app
> (textfield?) but maybe the extended characters aren't embedded ?
>
> If you "trace" the value, does it display correctly in the output window?
>
> It's possible also that you might have to "encode" your string as unicode
> in php before sending it out for flash to recognise it.
>
> Might be more of an Actionscript forum question altogether though...
>
> Ben
>
> Rune Høck Møller wrote:
>
> Hi All,
>
> I am having problem with showing foreign characters with swx.
>
> My setup:
>
> I get text into flash from a mysql with swx.
>
> I have embedded the specific characters needed ( danish characters æøå )
> in flash and tried with " System.useCodepage = true; " but nothing works.
>
> I have also tested my php script in the browser and it returns the
> characters just fine.
>
> My question is:
>
> Am I doing something wrong?
>
> Is the swx not build for foreign languages?
>
> Thanks in advance,
>
> Rune
>
> ------------------------------
>
> _______________________________________________
> swx mailing listswx at osflash.orghttp://osflash.org/mailman/listinfo/swx_osflash.org
>
>
> ------------------------------
>
> _______________________________________________
> swx mailing listswx at osflash.orghttp://osflash.org/mailman/listinfo/swx_osflash.org
>
>
> _______________________________________________
> swx mailing list
> swx at osflash.org
> http://osflash.org/mailman/listinfo/swx_osflash.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/swx_osflash.org/attachments/20071212/054e1027/attachment-0001.html
More information about the swx
mailing list