title: Xamarin - Encoding Error 1252 data could not be found
body: <p>I am working on an application in <code>Xamarin</code> for <code>Visual Studio 2017</code>. I am attempting to test my application on <code>Android</code> and <code>iOS</code> live player devices. 
  When I try to run it, I get the following error on my device (<code>Android</code> and <code>iOS</code>):</p>
  
  <blockquote>
    <p>Level=Error, Title=Visualization Error, Message=Encoding 1252 data
    could not be found. Make sure you have correct international codeset
    assembly installed and enabled. (NotSupportedException)</p>
  </blockquote>
  
  <p>I have found similar issues through <code>Google</code> searching, but after making the changes, it still will not run. I have checked all Internationalization options for both devices, and I have even saved directly as <code>UTF-8</code> encoding, as I figured it may be an issue with encoding <code>windows-1252</code>. I also referenced the <code>I18N.dll</code> to the <code>I18N.West.dll</code> for both.</p>
  
  <p>Any help would be greatly appreciated. Thank you.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I have been able to narrow down the issue further.</p>
  
  <pre><code>using (SqlConnection sqlConn = new 
   SqlConnection(Configuration.ConnectionString))
  {
      //sqlConn.Open(); 
  }
  </code></pre>
  
  <p>The <code>.open</code> was causing the encoding error. After commenting it out, the app will run on the live device, however, I now get:</p>
  
  <blockquote>
    <p>Level=Error, Title=Uncaught Exception, Message=Encoding 1252 data could not be found. Make sure you have correct international codeset assembly installed and enabled. (NotSupportedException)</p>
  </blockquote>
  
  <p>And <code>Visual Studio 2017</code> throws the following error </p>
  
  <blockquote>
    <p>System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.</p>
  </blockquote>
  
  <p>at </p>
  
  <pre><code>using (SqlConnection sqlConn = new 
  SqlConnection(Configuration.ConnectionString))
  </code></pre>
  
  <p>It occurs the moment it tries to pull from the database at the <code>using</code> statement above. I am using <code>SQL Server 2008 R2</code>. All I can tell is that it is having an issue with sending to and receiving from the SQL Server with <code>Android</code> and <code>iOS</code>.</p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>After using some <code>Exception Handlers</code>, I boiled it down to this inner exception:</p>
  
  <blockquote>
    <p>{System.NotSupportedException: Encoding 1252 data could not be found. Make sure you have correct international codeset assembly installed and enabled.
      at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x0023f] in &lt;896ad1d315ca4ba7b117efb8dacaedcf>:0 
      at Mono.Data.Tds.TdsCharset.GetEncodingFromSortOrder (System.Int32 sortId) [0x00022] in :0 
      at Mono.Data.Tds.TdsCharset.GetEncodingFromSortOrder (System.Byte[] collation) [0x00006] in :0 
      at Mono.Data.Tds.TdsCharset.GetEncoding (System.Byte[] collation) [0x00008] in :0 
      at Mono.Data.Tds.Protocol.Tds.ProcessEnvironmentChange () [0x00229] in :0 
      at Mono.Data.Tds.Protocol.Tds.ProcessSubPacket () [0x00129] in :0 
      at Mono.Data.Tds.Protocol.Tds.NextResult () [0x00039] in :0 
      at Mono.Data.Tds.Protocol.Tds.SkipToEnd () [0x00000] in :0 
      at Mono.Data.Tds.Protocol.Tds70.Connect (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters) [0x0058e] in :0 
      at Mono.Data.Tds.Protocol.Tds80.Connect (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters) [0x00000] in :0 
      at System.Data.SqlClient.SqlConnection.Open () [0x00245] in &lt;868a6461786e4884ac572c5e90a6b7fd>:0 
      at System.Data.Common.DbDataAdapter.QuietOpen (System.Data.IDbConnection connection, System.Data.ConnectionState&amp; originalState) [0x0000c] in &lt;868a6461786e4884ac572c5e90a6b7fd>:0 
      at System.Data.Common.DbDataAdapter.FillInternal (System.Data.DataSet dataset, System.Data.DataTable[] datatables, System.Int32 startRecord, System.Int32 maxRecords, System.String srcTable, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) [0x0002d] in &lt;868a6461786e4884ac572c5e90a6b7fd>:0 
      at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet, System.Int32 startRecord, System.Int32 maxRecords, System.String srcTable, System.Data.IDbCommand command, System.Data.CommandBehavior behavior) [0x00069] in &lt;868a6461786e4884ac572c5e90a6b7fd>:0 
      at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet) [0x00029] in &lt;868a6461786e4884ac572c5e90a6b7fd>:0 
      at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&amp;)
      at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in &lt;896ad1d315ca4ba7b117efb8dacaedcf>:0 }</p>
  </blockquote>
  
  <p>Which occurs at:</p>
  
  <pre><code>DataSet ds = new DataSet();
  SqlDataAdapter da = new SqlDataAdapter(cmd);
  da.Fill(ds);
  </code></pre>