English 中文(简体)
检测多种特性编码
原标题:Detecting Multi-Byte Character Encodings

C. 什么 图书馆有用于探测特性阵列(char*)的多维特性编码(UTF-8、UTF-16等)。 如果配对人停下来,即检测到prefix>/em>与一套可能的编码相匹配。

最佳回答
问题回答

If the input is only ASCII, there s no way to detect what should be hone had there been any high-bit-set bytes in the stream. May as well just pick UTF-8 in that case.

至于UTF-8诉ISO-8859-x,如果 par子失败,你可以尝试将投入作为UTF-8,然后回到ISO-8859。 确实没有检测的ISO-8859变量。 我建议研究一下航天飞机的运作方式,但这种方式并非无能为力,可能取决于是否知道输入是超文本。

总的说来,除了案文有某些特别标志说明编码外,还不可能发现编码的性质。 您可以直观地通过字典来检测一种编码,这些字体中仅存在于一些编码中。

This can of course only be a heuristic and you need to scan the whole text.

Example: "an English text can be written in multiple encodings". This sentence can be written for example using a German codepage. It s indistinguishable from most "western" encodings (including UTF-8) unless you add some special characters (like ä) that are not present in ASCII.





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?