Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi all ,

I need to encode from UTF-8 to UTF-16.i have used the snippet given in the BREW MP SDK.but its not working.its throwing an error when the control comes to ICharsetConv_CharsetConvert and crashing my simulator.

How do i convert the string from UTF-8 TO UTF-16? do i need to add anything in the mif file ? do i need to add any dependencies ?

put throw some light on this issue.
thanks in advance this is the snippet qualcomm has given..

char cSrc[] = "Hello World";
char cDst[50];
int nSrc = sizeof(cSrc), nDst = sizeof(cDst);
int nErr, nConv = 0;
AEECLSID cls;
ICharsetConv * piConv = NULL;

cls = ISHELL_GetHandler(ps, AEEIID_ICharsetConv, "UTF-8>UTF-16");
if(0 == cls) {
return AEE_EFAILED;
}

nErr = ISHELL_CreateInstance(ps, cls, (void**) &piConv);
if(AEE_SUCCESS != nErr) {
return nErr;
}

nErr = ICharsetConv_Initialize(piConv, "UTF-8", "UTF-16", 0x20);
if(AEE_SUCCESS != nErr) {
return nErr;
}

nErr = ICharsetConv_CharsetConvert(piConv,
(unsigned char **)&cSrc, &nSrc,
(unsigned char **)&cDst, &nDst, &nConv); /*not able to convert */
if(AEE_SUCCESS != nErr) {
return nErr;
}

i had the same issue, but there's no answer in anywhere (include official SDK, web or forum), i don't why the forum still exist without any tech support!!!!
and so i think Brew Mp was the worst platform in the world! And onbody want to use it!

i had the same issue, but there's no answer in anywhere (include official SDK, web or forum), i don't why the forum still exist without any tech support!!!!
and so i think Brew Mp was the worst platform in the world! And onbody want to use it!

currently there seems to be some issue with UTF-8 to UTF-16 conversion using ICharSetConv.all other conversions should work, like i checked UTF-8 to Shift_JIS , UTF-16 to UTF-8.
you may use ucs_Utf8ToUtf16() in AEEucs.h for this purpose for now.  Note: After ICharsetConv_CharsetConvert() is exicuted, the source & the destination buffer pointers are moved forward to the Last consumed byte & last produced byte respectively. So you may need to store the original pointers you pass, to use the results later.

currently there seems to be some issue with UTF-8 to UTF-16 conversion using ICharSetConv.all other conversions should work, like i checked UTF-8 to Shift_JIS , UTF-16 to UTF-8.
you may use ucs_Utf8ToUtf16() in AEEucs.h for this purpose for now.  Note: After ICharsetConv_CharsetConvert() is exicuted, the source & the destination buffer pointers are moved forward to the Last consumed byte & last produced byte respectively. So you may need to store the original pointers you pass, to use the results later.