/* * Convert ansi to utf-8 * it does not support more that utf-16 * the table we are using is base on utf-16 then we convert the table to utf-8 * * All table lookup the ansi char to utf-16 then we calc the utf-8 format. */ #include "oem437.h" /* windows oem 437 */ #include "oem850.h" /* windows oem 850 */ #include "Windows28591.h" /* windows 28591 aka ISO-2859-1 (Latin 1) */ #include "Windows28592.h" /* windows 28592 aka ISO-2859-2 (Latin 2) */ int ansiCodePage(int codepage, unsigned char *inBuffer, unsigned char *outBuffer, int Lenght) { int t; int ch; int pos=0; for (t=0;t> 6)); // 110x xxxx outBuffer[pos+1]= 0x80 | (0x3f & ch); // 11xx xxxx pos+=2; } else if (ch <=0xFFFF) // 11 11 11 11 11 11 11 11 { outBuffer[pos]= 0xC2 | (0xf & (ch >> 12)); // 1110xxxx outBuffer[pos+1]= 0x80 | (0x3f & (ch >> 6)); // 10xxxxxx outBuffer[pos+1]= 0x80 | (0x3f & ch); // 10xxxxxx pos+=3; } } return pos; }