UTF8/unicode conversions

Login to reply to this topic.
Thu, 2005-08-18 14:52
Joined: 2005-08-18
Forum posts: 1
Can someone point me to right direction here? Smiley I'm relatively new to symbian and this is giving me headache. I need to strip path information off from UTF8 string that is stored in unsigned char pointer but this solution doesn't seem to work.

Code:
RemovePath( unsigned char *aString, unsigned short &aLen )
{
TPtr8 ptr8((TText8 *)aString, aLen);

HBufC* hBuf16 = HBufC::NewL(aLen);
TPtr ptr16(hBuf16->Des());
ptr16.Copy(ptr8);

if( KErrNone != CnvUtfConverter::ConvertToUnicodeFromUtf8(ptr16, ptr8) )
return;

TParse p;
p.Set(ptr16, NULL, NULL);

aLen = (p.NameAndExt()).Length();

CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr8, p.NameAndExt() );

delete hBuf16;
hBuf16 = 0;
}
  • Login to reply to this topic.