Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:System.Text.Encoding' does not contain a definition for 'Default'

I am getting the following error: 'System.Text.Encoding' does not contain a definition for 'Default' when I am trying to use Default method of Encoding through

var str2 = System.Text.Encoding.Default.GetString(bytearray);

Through,MSDN I have learn there exist Default method in System.Text.Encoding, then why I am getting this error? MSDN refrence for Default is here:enter link description here

please help me out.

like image 736
creativemujahid Avatar asked Feb 16 '23 03:02

creativemujahid


1 Answers

Encoding.Default refers to the system-default ANSI code-page in regular windows, inherited from the depths of time. Even on regular windows, it is not a good idea to use Encoding.Default. No such concept exists on windows phone, so : use the correct encoding; which usually means .UTF8.

Windows phone does not use the same .NET framework as windows, although they are very similar and much code will compile identically.

like image 128
Marc Gravell Avatar answered May 19 '23 17:05

Marc Gravell