Dan Fitzpatrick
7/18/2005 1:00:00 PM
I am trying to port the OLE Reader from PHP to read Excel files on any
platform. I am stuck on the following function:
function GetInt4d($data, $pos) {
return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | (ord($data[$pos+3]) << 24);
}
My ruby version is:
def get_int_4_d(data, pos)
(data[pos]) | ((data[pos+1]) << 8) | ((data[pos+2]) << 16) | ((data[pos+3]) << 24)
end
It works in some cases but in the example xls file I am using, when
data[pos,0] is the character þ, the function returns -2 in PHP and
4294967294 in Ruby.
Thanks for your help.
Dan