charconvfw/charconv_fw/tools/convtool/utf.cpp
changeset 64 f66674566702
parent 0 1fb32624e06b
equal deleted inserted replaced
59:7d891bb52a7d 64:f66674566702
    14 * Description: 
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <STDLIB.H>
    19 #include <stdlib.h>
    20 
    20 
    21 const int KErrorIllFormedInput=-1;
    21 const int KErrorIllFormedInput=-1;
    22 
    22 
    23 int Utf8ToUnicode(wchar_t* aUnicode, const char* aUtf8)
    23 int Utf8ToUnicode(wchar_t* aUnicode, const char* aUtf8)
    24 // must '\0'-terminate the output
    24 // must '\0'-terminate the output
   130 		{
   130 		{
   131 		*aUnicode='\0';
   131 		*aUnicode='\0';
   132 		}
   132 		}
   133 	return aUnicode-startOfUnicode;
   133 	return aUnicode-startOfUnicode;
   134 	}
   134 	}
   135 #include <STDIO.H>
   135 #include <stdio.h>
   136 int UnicodeToUtf8(char* aUtf8, const wchar_t* aUnicode)
   136 int UnicodeToUtf8(char* aUtf8, const wchar_t* aUnicode)
   137 // must '\0'-terminate the output
   137 // must '\0'-terminate the output
   138 	{
   138 	{
   139 	char* startOfUtf8=aUtf8;
   139 	char* startOfUtf8=aUtf8;
   140 	for (;;)
   140 	for (;;)
   221 		*aUtf8='\0';
   221 		*aUtf8='\0';
   222 		}
   222 		}
   223 	return aUtf8-startOfUtf8;
   223 	return aUtf8-startOfUtf8;
   224 	}
   224 	}
   225 
   225 
       
   226