views:

85

answers:

4

As title says need to convert a Zip file to text file , no matter the size and no matter if it will make sense or not.But i need to reconvert it to that zip file again (Lose less). The main problem i am having is how to find a alternative text/number version of a character.

The Ascii wont work clearly ,So need help what can be a alternative text for a character specially that garbage looking binary chars in zip , when you see in a editor.

I am not a native English speaker , so i hope the above will make a sense to you guys :)

+3  A: 

Look into Base 64 encoding. PHP has functions for this.

Jeff
A: 

Try using base64 encoding the zip file into a text file http://en.wikipedia.org/wiki/Base64

Obsidian
+2  A: 

I think what you are looking for is base64_encode and base64_decode. You can use those functions to convert any arbitrary binary data to text, then back to binary again.

Of course it has the side effect of increasing the size of the data by about 33%

Eric Petroelje
A: 

Sounds like you want to use uuencode, which basically converts binary data into an ASCII-transferale archive.
PHP also has base64_encode(), what most people would use here. And as last resort, there is also quoted_printable_encode()

mario