last time i accidentely posted this question as a reply to another one…
i´m really sorry for that. i will not make that mistake again.
so here´s my question again in a fresh new thread
i´m having a small problem with base64 decoding a string.
i´m porting a php script over to ruby and the decoding gives me
different results in ruby and in php. the problem is that the php
results works for the processing i do afterwards while the ruby version
here´s the scripts in question:
php:<? $bytes = file_get_contents("test.rgb"); $bitmap = base64_decode($bytes); $header = ""; $header .= "\xFF\xFE"; $header .= pack("n2",120,97); $header .= "\x01"; $header .= "\xFF\xFF\xFF\xFF"; $header .= $bitmap; file_put_contents("test_php.gd",$header); ?>
all_bytes = Base64.decode64(IO.read(“test.rgb”))
bitmap = “\xFF\xFE”
bitmap << [120,97].pack(“n2”)
bitmap << “\x01”
bitmap << “\xFF\xFF\xFF\xFF”
bitmap << all_bytes
the ruby version is one byte shorter.
i´m probably missing something rather obvious here, but any pointers to
how i can make the ruby output be like the php output would be greatly
i´ve uploaded the test.rgb file i´m using to here:
http://rss.fork.de/test.rgb if that´s even needed
thanks a lot,