Hi,
I have isolated a problem that appears only when a SWF (built using
Flex 2.0.1) runs under Macintosh:
The flex application reads a binary data package (serialized on a
windows server) using an URLLoader
In that binary stream the server serialize things like numbers,
single bytes and strings.
All is OK with the de-serialization of the data except with strings.
They are serialized in a very simple way: first a byte containing the
string's length and, then, the characters stream encoded
using "Windows-1252".
When the application tries to de-serialize such a string, it first
read the string's length (ByteArray.readByte) and then, it tries to
read the "string body" using ByteArray.readMultiByte() method.
The result: when the client is a windows box (using firefox or MSIE)
there is not any problem. However, when the client is a Mac box (OSX
10.4 with FireFox) readMultiByte gives a different result each time
it de-serialize the (same) binary stream.
The function where the problem is isolated is the following:
public function readString(binData:ByteArray):String
{
var str:String="";
var length:int = binData.readUnsignedByte();
str = binData.readMultiByte(length, "Windows-1252");
return str;
}
I think that I could get rid of the problem by reading each single
string's character and applying my self the conversion from Windows-
1252 to UTF-8, but I would like to rely on ByteArray.readMultiByte.
Have anybody out there found also this problem?
Perhaps it is not a problem and I am doing something in the wrong
way, Could anybody help?
Thanks in advance.