doesn't display special french characters ...

47 views
Skip to first unread message

Danny De Keuleneire

unread,
Aug 13, 2015, 10:42:35 AM8/13/15
to eID Middleware Dev
Hello,

I succeeded to compile SDK_Example data.c with visual studio under Windows and the ID is readed but instead of the special french characters in the names I get ..
Any solution for this?

Kr,

Danny

Frederik Vernelen

unread,
Aug 13, 2015, 10:52:19 AM8/13/15
to eID Middleware Dev
Hello Danny,

Its the Beidsdk_PrintValue() function in data.c, which only prints the alfabet.
If you remove the  && (*(pValue+counter) < 0x81)  , you will see a lot more.

Wkr,
 Frederik

--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Danny De Keuleneire

unread,
Aug 15, 2015, 7:01:17 AM8/15/15
to eID Middleware Dev
Sorry but where do you see this?:

void Beidsdk_PrintValue(CK_CHAR_PTR pName, CK_BYTE_PTR pValue, CK_ULONG valueLen)
{
unsigned long counter = 0;
printf("%s:\n\n",pName);
if(pValue != NULL)
{
while (counter < valueLen)
{
if( isprint(*(pValue+counter)) )
printf("%c", *(pValue+counter));
else
printf(".", *(pValue+counter));
counter++;
}
}
printf("\n");
}

On Thursday, 13 August 2015 16:52:19 UTC+2, fvernelen wrote:
Hello Danny,

Its the Beidsdk_PrintValue() function in data.c, which only prints the alfabet.
If you remove the  && (*(pValue+counter) < 0x81)  , you will see a lot more.

Wkr,
 Frederik
On Thu, Aug 13, 2015 at 3:34 PM, Danny De Keuleneire <sha...@gmail.com> wrote:
Hello,

I succeeded to compile SDK_Example data.c with visual studio under Windows and the ID is readed but instead of the special french characters in the names I get ..
Any solution for this?

Kr,

Danny

--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsub...@googlegroups.com.

Danny De Keuleneire

unread,
Aug 18, 2015, 4:32:43 AM8/18/15
to eID Middleware Dev
Here is the solution just put it in a nice function and ready to go ;-)

main()
{
int i=0;
char ansi[128];
char* pAnsi = ansi;
char pUtf8[30];
strcpy(pUtf8,"Frédéricýýýý");

while (pUtf8[i])
{
if ((pUtf8[i] & 0x80) == 0)
{ // ASCII : 0000 0000-0000 007F 0xxxxxxx
*pAnsi = pUtf8[i];
++i;
}
else if ((pUtf8[i] & 0xE0) == 0xC0)
{ // 0000 0080-0000 07FF 110xxxxx 10xxxxxx
*pAnsi = (pUtf8[i] & 0x1F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 1] & 0x3F);
i += 2;
}
else if ((pUtf8[i] & 0xF0) == 0xE0)
{ // 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
*pAnsi = (pUtf8[i] & 0x0F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 1] & 0x3F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 2] & 0x3F);
i += 3;
}
else if ((pUtf8[i] & 0xF8) == 0xF0)
{ // 0001 0000-001F FFFF 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
*pAnsi = (pUtf8[i] & 0x07);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 1] & 0x3F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 2] & 0x3F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 3] & 0x3F);
i += 4;
}
else if ((pUtf8[i] & 0xFC) == 0xF8)
{ // 0020 0000-03FF FFFF 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
*pAnsi = (pUtf8[i] & 0x03);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 1] & 0x3F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 2] & 0x3F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 3] & 0x3F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 4] & 0x3F);
i += 5;
}
else if ((pUtf8[i] & 0xFE) == 0xFC)
{ // 0400 0000-7FFF FFFF 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
*pAnsi = (pUtf8[i] & 0x01);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 1] & 0x3F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 2] & 0x3F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 3] & 0x3F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 4] & 0x3F);
*pAnsi <<= 6;
*pAnsi += (pUtf8[i + 5] & 0x3F);
i += 6;
}
else
{
*pAnsi = '?';
}
pAnsi++;
}
*pAnsi = 0;
// std::string strAnsi(ansi);
printf("[%s][%s]\n",pUtf8,ansi);
return (0);
}
 
Reply all
Reply to author
Forward
0 new messages