0

I have a file with contents looking like PK\u0003\u0004\u0014\u0000\u0006\u0000\b\u0000\u0000\u0000!\u0000À¸<91><91>¢\u0001.

However, I have a different version of the same file looking like PK^C^D^T^@^F^@^H^@^@^@!^@À¸<91><91>¢^A

I would like to "interpret" the first file, so that hex codes (6 characters each, including \u) get resolved to actual characters. However, as you see, the file is not really binary, but rather contains text representation of some hex codes (as well as some interpreted ones, like ! etc.)

I thought about using xxd -r, with just a few obviously wrong characters as a result. How can I convert my 1st file so that it resembles the 2nd version of it?

  • This looks very much like the first few bytes of a zip file. Give it a .zip extension and then try to open it. – Berend Jan 11 at 13:06
  • It is, in fact, intended to be a .zip file. However, because of how it is currently written (bytes representing characters like \u0000 rather than 0), just changing the extension does not work. – 3yakuya Jan 11 at 13:14
  • OK, I see. But what about the other characters, i.e. À,<91> etc? Are those straight UTF8 characters? (And why would anyone write a zipfile this way?) – Berend Jan 11 at 13:19
  • Receiving a zipfile via wire, where it was uploaded to the browser and the browser just sends it to me. Those characters when checked in Vim has hex representation as I would expect them (ex. À is 00c0, as expected.) – 3yakuya Jan 11 at 13:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.