Zutf8_16.h file:
 
//---------------------------------------------------------------------------
#ifndef zutf8_16h
#define ZUTF8_16H
//---------------------------------------------------------------------------
/*
Classes that support the conversion between Unicode,unicode be, Utf8,ascii.
Date: 2007-06-15
Version: 1.0
Author: Little Elephant
Website: http://www.9ele.com
E-mail: zxjrainbow@9ele.com//Do not send spam to me ~ ~
Description: You can use this file at will, but if you modify the bug,
or modify it better, please let me know,
Let me also enjoy the benefits of open source, thank you.
*/
Enum Encodingtype
{
Uni8bit = 0,//default ASCII
Uni16be = 1,
Uni16le = 2,//Windows default encoding, which is Unicode
UniUTF8 = 3,
Uniutf8nobom = 4//UTF8 file with no UTF8 identifier header
};
Class Zutf8_16
{
Private
Encodingtype M_unicodemode; Encoding method
int isutf8_16 (const char *s, unsigned int len, unsigned *cchunused);
Encodingtype __fastcall determineencoding (unsigned char *data, size_t Ilen);
Public
__fastcall zutf8_16 ();
__fastcall ~zutf8_16 ();
Encodingtype __fastcall getencodingtype (void) {return m_unicodemode;};
BOOL __fastcall Loadfromstream (Tmemorystream *pstream, ansistring &desttext);
BOOL __fastcall streamsavetofile (Tmemorystream *pstream,
Ansistring Filenamea, Encodingtype unicodemode);
};
#endif