Interpret text file with some hex codes?
I have a file with contents looking like PKu0003u0004u0014u0000u0006u0000bu0000u0000u0000!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?
encoding character-encoding
add a comment |
I have a file with contents looking like PKu0003u0004u0014u0000u0006u0000bu0000u0000u0000!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?
encoding character-encoding
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 likeu0000
rather than0
), 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.À
is00c0
, as expected.)
– 3yakuya
Jan 11 at 13:22
add a comment |
I have a file with contents looking like PKu0003u0004u0014u0000u0006u0000bu0000u0000u0000!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?
encoding character-encoding
I have a file with contents looking like PKu0003u0004u0014u0000u0006u0000bu0000u0000u0000!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?
encoding character-encoding
encoding character-encoding
asked Jan 11 at 12:53
3yakuya3yakuya
1365
1365
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 likeu0000
rather than0
), 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.À
is00c0
, as expected.)
– 3yakuya
Jan 11 at 13:22
add a comment |
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 likeu0000
rather than0
), 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.À
is00c0
, as expected.)
– 3yakuya
Jan 11 at 13:22
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
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
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
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
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
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1393156%2finterpret-text-file-with-some-hex-codes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1393156%2finterpret-text-file-with-some-hex-codes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
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 than0
), 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.
À
is00c0
, as expected.)– 3yakuya
Jan 11 at 13:22