html entity to unicode
-
Hello, I have a tricky problem and I hope anyone can point me a solution. I have an C++ Unicode application that received a parameter form the browser. If the parameter is a Greek word for example, I get something like this &u=%u03C5%u03B2%u03AD& (html entities). Does anyone know an efficient method to convert the html entity into the Greek character? Thanks.
-
Hello, I have a tricky problem and I hope anyone can point me a solution. I have an C++ Unicode application that received a parameter form the browser. If the parameter is a Greek word for example, I get something like this &u=%u03C5%u03B2%u03AD& (html entities). Does anyone know an efficient method to convert the html entity into the Greek character? Thanks.
-
micutzu wrote:
&u=%u03C5%u03B2%u03AD&
one doubt. In the above string does 03c5,03b2... represents some Greek character?
nave
-
I think the below code will work.. wchar_t* ptext = _T("%u03C5%u03B2%u03AD&"); wchar_t* pEntity = new wchar_t[ _tcslen( ptext ) + 1]; _tcscpy( pEntity, ptext ); /// in u r case u can start from here wchar_t pGreek[50] = {0}; int ncount = _tcslen( pEntity ); int nChar = 0; wchar_t *pStart = pEntity + 2; for( int i = 0, j = 0; i< ncount-2; j++, i += 6 ) { *(pStart + 4) = 0; *(pStart + 5) = 0; swscanf( pStart , _T("%x"), &nChar ); pGreek[j] = nChar; pStart+= 6; } AfxMessageBox( pGreek); delete[] pEntity;
nave