Menu

#12 International Characters parsed incorrectly

open-works-for-me
nobody
None
5
2006-02-20
2006-02-20
Anonymous
No

Data with international characters such as 'ñ' is not
parsed correctly; the whole data gets corrupted.

Discussion

  • Alessandro Crugnola

    Logged In: YES
    user_id=634570

    do you mean from PHP to AS or AS to PHP?
    can you provide me an example?

    p.s. remember that if you're passing data from php,
    everything must be UTF-8 format (and dont' use useCodePage =
    true in flash)

     
  • Alessandro Crugnola

    • status: open --> open-works-for-me
     
  • Anonymous

    Anonymous - 2006-03-18

    Logged In: YES
    user_id=1479825

    Tip: Use the PHP <a
    href="http://php.net/utf8_encode">utf8_encode</a> to encode
    data before sending it to Flash. PHP also provides a <a
    href="http://php.net/utf8_decode">utf8_decode</a> function.

     
  • Nobody/Anonymous

    Logged In: NO

    I had the same issue. Check out the "Revised calcLength()
    function" posting which fix the problem for me.

     
  • afriedel

    afriedel - 2006-04-12

    Logged In: YES
    user_id=1500907

    revised calcLength() didn't work my case.

    As workarround you may escape the strings containing the
    international characters before serializing them.

    as:
    serialize(escape(var)) ...
    php:
    utf8_decode(urldecode(unserialize(utf8_decode(var)))) ...

     
  • Nobody/Anonymous

    Logged In: NO

    This may be related to the utf8_encode php function. This
    function needs to be called when data is being serialized
    and sent to flash, for example:

    echo "&output=" . urlencode(utf8_encode(serialize($pages)));

    However, besure not to call utf8_encode twice! If your data
    is from a database and already encoded in utf8 then you will
    see problems.

     
  • Nobody/Anonymous

    Logged In: NO

    hi. With this change, the caracters start to be parsed ok. It´s just a sugestion and I´m not 100% sure of no colateral effects, but worked for me.

    case "s":
    var len_end:uint = data.indexOf(":", Serializer.c+2);
    var len:uint = data.substring(Serializer.c+2, len_end); trace(len+','+len_end);
    Serializer.c = len_end+2;

    result = data.substr(Serializer.c, len);
    Serializer.c += (len+2);

    if(Serializer.pattern.test(result)){
    result = new Date(result)
    }
    break;

    []´s
    Labs

     
  • Nobody/Anonymous

    Logged In: NO

    See the prior Bug Post #1433083 to correct this error.

     
  • Nobody/Anonymous

    Logged In: NO

    unserializing special characters presents a similar problem that calcLength() does not fix. The fix I am using is in the function getCStringLenght:

    // change from 128 to 255 to allow special characters
    if (cstr.charCodeAt (i + startIndex) > 255){
    j = j - 1
    }

     
  • Nobody/Anonymous

    hallo ,

    read all that - did fix my prob with french and spanish chars neatly .. but what about the €uro sign ? cant get ist working - receive always questionmarks after deserializing

     

Log in to post a comment.