究竟是什么导致二进制文件“乱码"? [英] What exactly causes binary file "gibberish"?

查看:755
本文介绍了究竟是什么导致二进制文件“乱码"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有找到这个特定问题的答案;也许没有.但是我一直想知道它.

I haven't found an answer to this particular question; perhaps there isn't one. But I've been wondering for a while about it.

在文本编辑器中查看二进制文件时,究竟是什么导致二进制文件显示为乱码"?加密文件也是一样.文件的二进制值是否试图转换为ASCII?是否可以将视图转换为显示原始二进制值,即显示组成文件的1和0?

What exactly causes a binary file to display as "gibberish" when you look at it in a text editor? It's the same thing with encrypted files. Are the binary values of the file trying to be converted into ASCII? Is it possible to convert the view to display raw binary values, i.e. to show the 1s and 0s that make up the file?

最后,有没有一种方法可以确定哪个程序可以正确打开数据文件?很多时候,尤其是在Windows中,文件是孤立的,或者与特定程序没有关联.在文本编辑器中打开它有时会告诉您它的位置,但由于杂乱无章,大多数时候不知道它的位置.如果扩展名不提供任何信息,您如何确定它属于哪个程序?

Finally, is there a way to determine what program will properly open a data file? Many times, especially with Windows, a file is orphaned or otherwise not associated w/ a particular program. Opening it in a text editor sometimes tells you where it belongs but most of the time doesn't, due to the gibberish. If the extension doesn't provide any information, how can you determine what program it belongs to?

推荐答案

  • 文件的二进制值是否试图转换为ASCII?
  • 是的,这就是正在发生的事情.通常,文件的二进制值还包含不可打印的ASCII控制字符,从而在典型的文本编辑器中显示甚至更加奇怪.

    Yes, that's exactly what's happening. Typically, the binary values of the file also include ASCII control characters that aren't printable, resulting in even more bizarre display in a typical text editor.

    • 是否可以将视图转换为显示原始二进制值,即 显示组成文件的1和0?
    • Is it possible to convert the view to display raw binary values, i.e. to show the 1s and 0s that make up the file?

    这取决于您的编辑器.您需要的是十六进制编辑器",而不是普通的文本编辑器.这将向您显示文件的原始内容(通常为十六进制而不是二进制,因为零和一会占用大量空间,并且较难读取).

    It depends on your editor. What you want is a "hex editor", rather than a normal text editor. This will show you the raw contents of the file (typically in hexadecimal rather than binary, since the zeros and ones would take up a lot of space and be harder to read).

    • 最后,有没有一种方法可以确定可以正确打开的程序 数据文件?
    • Finally, is there a way to determine what program will properly open a data file?

    有一个名为文件" 的Linux命令行程序会尝试分析文件(通常查找常见的标头模式)并告诉您文件的类型(例如文本,音频,视频,XML等).我不确定是否有Windows的等效程序.当然,该程序的输出只是一个猜测,但是当您不知道文件格式是什么时,它可能会非常有用.

    There is a Linux command-line program called "file" that will attempt to analyze the file (typically looking for common header patterns) and tell you what sort of file it is (for example text, or audio, or video, or XML, etc). I'm not sure if there is an equivalent program for Windows. Of course, the output of this program is just a guess, but it can be very useful when you don't know what the format of a file is.

    这篇关于究竟是什么导致二进制文件“乱码"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆