Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6561847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:38:18+00:00 2026-05-25T13:38:18+00:00

I have lately been trying to read about how everything with strings and encodings

  • 0

I have lately been trying to read about how everything with strings and encodings work.

My question is this, the method:

public static byte[] Convert(
Encoding srcEncoding,
Encoding dstEncoding,
byte[] bytes
)

What is actually going on behind the scenes, is it using a StringBuilder to check each char and then replacing them according to the specified Encoding or what?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:38:18+00:00Added an answer on May 25, 2026 at 1:38 pm

    I’d expect it to be effectively:

    string text = srcEncoding.GetString(bytes);
    return destEncoding.GetBytes(text);
    

    Now it may do it in a more memory-efficient way than that – but effectively it needs to decode the original binary data and encode it again as binary data in the other encoding.

    Note that performing encoding on a character-by-character basis doesn’t always work – for example, one UTF-8 byte sequence may decode to a single Unicode code point represented as a surrogate pair of UTF-16 code units (char values). Using an Encoder and Decoderpair would allow "chunks" of data to be encoded/decoded at a time, removing the need for the whole text data to be in memory at one time... possibly writing to aMemoryStream` or something similar to store the encoded data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to learn more about lambda expressions lately, and thought of
I have been doing some research lately over my work project, i am trying
I have been reading about Factory pattern a lot lately. I am trying to
I have been thinking and learning a lot about forms lately trying to add
Lately I have been trying my hands on Eclipse IDE for java development. I
Lately I have been reading a lot of blog topics about big sites(facebook, twitter,
I have been working with SharpSVN quite a bit lately and I'm currently trying
Okay so I have been trying to get into IoC lately. However, I keep
I have been reading a lot about Reinforcement Learning lately, and I have found
I've been running into this problem a lot lately. I have an NSMutableArray called

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.