Conversion of characters from UTF-8 to OEM

434 views
Skip to first unread message

KG

unread,
May 12, 2011, 8:23:23 AM5/12/11
to eID Middleware Dev
Hello,

I use the c# wrapper to read eID cards.
The resulting data for example with getStreet() is always in UTF-8 ?
How can i write this data to a txt file with OEM encoding ?
I ask this because the txt file has to be read with a vb6 application
and for the moment i get "ë" where there has to be a "ë".

With kindly regards,

Kris

Frederik Vernelen

unread,
May 12, 2011, 10:44:43 AM5/12/11
to KG, eID Middleware Dev
Hi Kris,

The data on the card is stored as utf8.
The c# and vb wrappers convert this to the c# and vb default strings (unicode 16)

For the text conversion functions, the following might help you :
http://msdn.microsoft.com/en-us/library/ms143456.aspx
http://msdn.microsoft.com/en-us/library/3aadshsx.aspx

Wkr,
 Frederik

KG

unread,
May 13, 2011, 8:05:54 AM5/13/11
to eID Middleware Dev
Hello,

This was the solution for me :

Encoding enc = Encoding.GetEncoding(1252, new
EncoderReplacementFallback(" "), new DecoderReplacementFallback(" "));
StreamWriter tw = new StreamWriter(strFile, false, enc);

Wkr,

Kris

On 12 mei, 16:44, Frederik Vernelen <frederik.verne...@gmail.com>
wrote:
> Hi Kris,
>
> The data on the card is stored as utf8.
> The c# and vb wrappers convert this to the c# and vb default strings
> (unicode 16)
>
> For the text conversion functions, the following might help you :http://msdn.microsoft.com/en-us/library/ms143456.aspxhttp://msdn.microsoft.com/en-us/library/3aadshsx.aspx
Reply all
Reply to author
Forward
0 new messages