Share

SerializerClass

Tracker: Bugs

5 International Characters parsed incorrectly - ID: 1435185
Last Update: Comment added ( nobody )

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


Nobody/Anonymous ( nobody ) - 2006-02-20 13:26

5

Open

Works For Me

Nobody/Anonymous

None

None

Public


Comments ( 8 )




Date: 2008-05-23 15:36
Sender: nobody

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
}


Date: 2007-11-29 13:42
Sender: nobody

Logged In: NO

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


Date: 2007-02-21 16:54
Sender: nobody

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


Date: 2006-05-30 15:17
Sender: nobody

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.



Date: 2006-04-12 20:54
Sender: angelo_friedel

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)))) ...


Date: 2006-04-03 14:10
Sender: nobody

Logged In: NO

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


Date: 2006-03-18 21:59
Sender: caktusaurus

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.


Date: 2006-02-20 13:46
Sender: sephiroth_tmmProject AdminAccepting Donations

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)


Log in to comment.




Attached File

No Files Currently Attached

Change ( 1 )

Field Old Value Date By
resolution_id None 2006-02-20 13:46 sephiroth_tmm