View Single Post
  #1  
Old May 15th, 2008, 12:53 AM
yogish yogish is offline
Registered User
 
Join Date: Mar 2007
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
yogish is on a distinguished road
convert a utf16 to utf8 to use in fopen

Hi,
i am converting a ascii to utf16 using following code.


void asciitounicode(unsigned short *unicode,char *str)
{
char *tmpstr;
unsigned short *tmpunicode = unicode;
tmpstr = (char *)str;

while( *tmpstr!= '\0' )
{
*tmpunicode = (unsigned short)*tmpstr;
tmpstr++;
tmpunicode ++;
}
*tmpstr= '\0';
}

now a want to convert the utf16 to utf8 so that it can be used in fopen which supports utf8 string.

thanks.
Reply With Quote