CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2013

    From UTF8 sting to byte array and vice versa


    I have a byte array (first_arr) I changed it to UTF8 string like this
    string utf_str = Encoding.UTF8.GetString(first_arr);
    Then I re-transferred it to byte array like this
    byte [] second_arr = Encoding.UTF8.GetBytes(utf_str);
    But the resulted array (second_arr) is different from the native one (first_arr) Why does that happen?

  2. #2
    Join Date
    Oct 2013

    Re: From UTF8 sting to byte array and vice versa

    Probably the first array was of a different encoding, try using ASCII or Default

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.