locked
System.Text.UTF8Encoding.GetBytes() vs System.Text.Encoding.UTF8Encoding.GetBytes() in .Net Core 2.0.2 RRS feed

  • Question

  • We have an old Silverlight application (5.0.5) that uses System.Text.UTF8Encoding.GetBytes() to convert a string and save it in a database.

    I am working on a different project in C# Core that needs to read/write to the same database, I have tried both System.Text.Encoding.UTF8Encoding.GetBytes() and System.Text.UTF8encoding.UTF8.GetBytes(). Though both of these give me the same results in C# that result is different than the Silverlight one.

    I thought it might be related to .Net Core so I did a quick VB.Net application using .Net Framework 4.5 using Encoding.UTF8Encode.GetBytes() and I get the same result as the C# application but still different from the Silverlight application.

    Can someone explain to me what the Silverlight version of the UTF8Encoding is doing?

    Thanks
    Friday, May 11, 2018 5:42 PM

All replies

  • This question is also posted in the Silverlight forums but maybe someone has some insight into this here as I am working in C#.

    We have an old Silverlight application (5.0.5) that uses System.Text.UTF8Encoding.GetBytes() to convert a string and save it in a database.

    I am working on a different project in C# Core that needs to read/write to the same database, I have tried both System.Text.Encoding.UTF8Encoding.GetBytes() and System.Text.UTF8encoding.UTF8.GetBytes(). Though both of these give me the same results in C# that result is different than the Silverlight one.

    I thought it might be related to .Net Core so I did a quick VB.Net application using .Net Framework 4.5 using Encoding.UTF8Encode.GetBytes() and I get the same result as the C# application but still different from the Silverlight application.

    Can someone explain (or insights) to me what the Silverlight version of the UTF8Encoding is doing?

    Thanks

    Friday, May 11, 2018 5:59 PM
  • Not without an example.  Show us the different result, and perhaps one of us can concoct an explanation.

    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Friday, May 11, 2018 9:26 PM