简体   繁体   English

在读取文件时,我是否需要考虑单一编码?

[英]While reading file, do i need to consider single encoding?

While reading file, do i need to consider single encoding ? 在读取文件时,我是否需要考虑单一编码?

Here, Idea is simple, every file is supported only single encoding and it's design base on data available in file. 在这里,Idea很简单,每个文件仅受单一编码支持,并且基于文件中可用的数据进行设计。

Different encoding like ..ASCII,UTF-8,UTF-16,ISO** etc. 不同的编码,例如..ASCII,UTF-8,UTF-16,ISO **等。

Most of case, we considered and read file using only single encoding that UTF-8 but some complex chars are not supported for this encoding and in that case, we get junk or fault data char. 在大多数情况下,我们仅考虑使用UTF-8的单一编码来读取文件,但是这种编码不支持某些复杂的字符,在这种情况下,我们会得到垃圾数据或故障数据字符。

How do you read file ? 您如何读取文件?

Your notion that a file have single encoding is not correct. 您认为文件具有单一编码的概念是不正确的。 See Character-set and Character-encoding are two different things. 请参阅字符集和字符编码是两件事。 You can say that a file includes characters from a given character-set like ASCII(Printable characters, certain non-printable and control characters), but how those characters will be represented is determined by character-encoding. 您可以说文件包含给定字符集中的字符,例如ASCII(可打印字符,某些不可打印字符和控制字符),但是这些字符的表示方式取决于字符编码。 Thus a file containing ASCII character set may be encoded using ASCII,UTF-8,UTF-16 and so on. 因此,可以使用ASCII,UTF-8,UTF-16等对包含ASCII字符集的文件进行编码。 Just open a text file in notepad++ and go in Encoding menu, You'll see different menu-items available for viewing file in different encoding. 只需在notepad ++中打开一个文本文件并进入“编码”菜单,您将看到可用于以不同编码查看文件的不同菜单项。

Hope it helps you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM