Convert Unicode to Utf8
Related Blog Items
- UTF8 To Unicode conversion program
- IEEE 754 Binary Floating Point Representation
- ASCII Case Conversion
- How are "private inheritance" and "composition" similar?
- indian language font developer
[highlight lang=”C”]
int UnicodeToUTF8(const WCHAR *Src, int SrcLen, unsigned char *Dest, int DestLen)
{
int i=0;
int outputlen=0; /*bytes */
char tchar;
if (!src || !dest)
{
return outputlen;
}
for ( i=0; i
if ( outputlen >= DestLen )
{
//overflow detected
break;
}
if ( 0xdfff > Src[i] && 0xd800 < Src[i] )
{
tchar = (((Src[i] & 0×3c0) >> 6) + 1);
Dest[outputlen++] = (tchar >> 2 | 0xf0);
Dest[outputlen++] = ((tchar & 0×03 | 0×80) | (Src[i] & 0×3e) >> 2);
}
else if ( 0×800 > Src[i] )
{
Dest[outputlen++]= (Src[i] >> 6 | 0xc0);
Dest[outputlen++]= (Src[i] & 0×3f | 0×80);
}
else if ( 0×80 > Src[i] )
{
strDest[outputlen++] = Src[i];
}
else
{
Dest[outputlen++] = (Src[i] >> 12 | 0xe0);
Dest[outputlen++] = (Src[i] >> 6 & 0×3f | 0×80);
Dest[outputlen++] = (Src[i] & 0×3f | 0×80);
}
}
Dest[outputlen] = ?\0?;
return outputlen;
}
[/highlight]
[tags]utf8, unicode, unicode to utf8, unicode to utf8 conversion, unicode to utf8 conversion program[/tags]
Popularity: 9%
You need to log on to convert this article into PDF
Related Blog Items - UTF8 To Unicode conversion program
- IEEE 754 Binary Floating Point Representation
- ASCII Case Conversion
- How are "private inheritance" and "composition" similar?
- indian language font developer
Related Blog Items
- UTF8 To Unicode conversion program
- IEEE 754 Binary Floating Point Representation
- ASCII Case Conversion
- How are "private inheritance" and "composition" similar?
- indian language font developer
November 1st, 2006 at 6:56 pm
good
December 2nd, 2006 at 7:18 pm