怎样读取文本文档中的unicode编码
在一个文本文档中,其中有几行是unicode码,请问如何用C语言程序查找定位这些行?小菜鸟。。。。
以下是同一文字在不同编码体系下的内码:
#include "stdafx.h" using namespace System; using namespace System::Text; using namespace System::IO; int main(array<System::String ^> ^args) { String^ content = "端面模数AZ1"; Encoding^ unicode = Encoding::Unicode; array<Byte>^ unicode_array = gcnew array<Byte>(unicode->GetByteCount(content)); Console::Write("Unicode: {0} ", content); unicode_array = unicode->GetBytes(content); for (int i = 0; i < unicode_array->Length; ++i) { Console::Write("{0:X2} ", unicode_array[i]); } Console::WriteLine(); Encoding^ ansi = Encoding::Default; array<Byte>^ ansi_array = Encoding::Convert(unicode, ansi, unicode_array); Console::Write(" ANSI: {0} ", ansi->GetString(ansi_array)); for (int i = 0; i < ansi_array->Length; ++i) { Console::Write("{0:X2} ", ansi_array[i]); } Console::WriteLine(); Encoding^ utf8 = Encoding::UTF8; array<Byte>^ utf8_array = Encoding::Convert(unicode, utf8, unicode_array); Console::Write(" UTF8: {0} ", utf8->GetString(utf8_array)); for (int i = 0; i < utf8_array->Length; ++i) { Console::Write("{0:X2} ", utf8_array[i]); } Console::WriteLine(); return 0; }