ELF 中需要的条目是否有标准编码?

发布于 2024-07-06 15:15:46 字数 190 浏览 8 评论 0原文

我试图让我的一些代码对非纯 ascii 系统更加友好,并且想知道 ELF 二进制文件中是否有用于 NEEDED 条目的特定字符编码,或者它是否相当不标准并且基于创建系统的文件系统编码(或者甚至直接传递给创建二进制文件的字节)(如果是的话,二进制文件中是否有任何地方指定编码?假设当前的系统编码不太适合我的使用,我认为) ,非 ASCII 名称几乎被禁止还是其他什么?

I'm trying to make some of my code a bit more friendly to non-pure-ascii systems and was wondering if there was a particular character encoding used for NEEDED entries in ELF binaries, or is it rather unstandard and based on the creating system's filesystem encoding (or even just directly the bytes that were passed to whatever created the binary) (if so is there any place in the binary that specifies the encoding? assuming the current systems encoding wouldn't work very well for my usage I think), are non-ascii names pretty much banned or something else?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜心小果奶 2024-07-13 15:15:46

ELF 格式将 NEEDED 字段指定为“空终止字符串”,并且没有说明有关编码的更多信息,这几乎意味着 8 位 ASCII 字符串。

我个人认为,使可执行文件格式规范复杂化没有任何意义,因为它不会为最终产品或开发过程提供任何附加价值:用户不会看到库名称,因此他们不会关心其本地化。 您可能尝试使用UTF-8,但实际的文件系统编码不保证是UTF-8。 为了确保您需要知道目标链接器如何处理这些字符串。

ELF format specifies NEEDED fields as "null-terminated string" and does not say more about the encoding, which pretty much implies 8-bit ASCII string.

I personally don't see any point in complicating executable file format specification that does not provide any additional value for the final product or development process: the user won't see library names, so they wouldn't care about localization of thereof. You may try to use UTF-8, but actual file system encoding is not guaranteed to be UTF-8. To be sure you need to know how your target linker handles those strings.

老娘不死你永远是小三 2024-07-13 15:15:46

据我所知,处理非 ASCII 字符的标准 Unix 方式是将它们编码为 UTF-8。

As far as I know, the standard Unix way of dealing with non-ASCII characters is to encode them as UTF-8.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文