I use tiled to create a tile map. (Tiled - tile map editor with support for orthogonal and isometric maps)
Saves the map in an XML file. It can use certain coding structures:
- plain base64
- base64 + gzip
- base64 + zlib
- regular csv
Now I completely abandoned gzip (my gzips server traces it anyway, so there are no losses) So I thought that I would try normal base64 decoding using the jQuery base64 plugin
But the data is output to all distorted ones, for example:
I assume this is binary coding, but how do I get around this?
Example data that needs to be decoded (regular base64):
jQAAAI4AAACPAAAAkAAAAJEAAACSAAAAkwAAAKEAAACiAAAAowAAAKQAAAClAAAApgAAAKcAAAA=
Example data to decode (gzipped base64):
H4sIAAAAAAAACw3DhwnAMAwAMP8P2Rdk9s1KoBQR2WK12R1Ol9vj9fn5A/luZ4Y4AAAA
Example csv data:
141,142,143,144,145,146,147, 161,162,163,164,165,166,167
So how can I rotate a regular base64 encoded bit and turn it into csv?
Edit:
Using Pointy found's solution, I got a semi-reflex array. However, after several thousand characters, two numbers will be erroneous. And even more often after that.
Then I found a man who also used tiled and base64 encoding in his circuit. After he decrypted the array, he also did this with it:
var d = base64_decode($(this).find('data').text()); var e = new Array(); for (var i = 0; i <= d.length; i += 4) { var f = d[i] | d[i + 1] << 8 | d[i + 2] << 16 | d[i + 3] << 24; e.push(f) }
I have no idea why this is necessary, but at least it works. If anyone can explain, please do it!