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 4576972
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:16:51+00:00 2026-05-21T20:16:51+00:00

I have done very little with encoding of Text. Truthfully, I don’t really even

  • 0

I have done very little with encoding of Text. Truthfully, I don’t really even know what it means exactly.

For example, if I have something like:

Dim myStr as String = "Hello"

Is that ‘encoded’ in memory in a particular format? Does that format depend on what language I’m using?

If I were in another country, like China, for example, and I had a string of Chinese (mandarin? My apologies if I’m using the wrong words here) would the following code (that I’ve used fine on English strings) still work the same?

System.Text.UTF8Encoding encoding=new System.Text.UTF8Encoding();
return encoding.GetBytes(str);

Or would it lose all meaning when you convert that .Net string to a UTF8Encoding when that conversion isn’t valid?

Finally, I’ve worked with .Net for a few years now and I’ve never seen, heard, or had to do anything with Encoding. Am I the exception, or is it not a common thing to do?

  • 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-21T20:16:52+00:00Added an answer on May 21, 2026 at 8:16 pm

    The .NET string class is encoding strings using UTF16 – that means 2 bytes per character (although it allows for special combinations of two characters to form a single 4 byte character, so called “surrogate pairs”) .

    UTF8 on the other hand will use a variable number of bytes necessary to represent a particular Unicode character, i.e. only one byte for regular ASCII characters, but maybe 3 bytes for a Chinese character. Both encodings allow representing all Unicode characters, so there is always a mapping between them – both are different binary represenations (i.e for storing in memory or on disk) of the same (unicode) character set.

    Since not all Unicode characters were able to fit into the original 2 bytes reserved by UTF-16, the format also allows to denote a combination of two UTF-16 characters to form 4 byte characters – the so formed character is called a “surrogate” or surrogate pair and is a pair of 16-bit Unicode encoding values that, together, represent a single character.

    UTF-8 does not have this problem, since the number of bytes per Unicode character is not fixed. A good general overview over UTF-8, UTF-16 and BOMs can be gathered here.

    An excellent overview / introduction to Unicode character encoding is The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets

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

Sidebar

Related Questions

I have very little idea what I'm doing here, I've never done anything like
I have been doing ASP.NET for a while, and have done very little in
I have, admittedly, done very little searching on my own, so feel free to
I have done some Java programming and very little C and PHP programming as
I have recently done a very simple highlighting with jQuery and a highlight plugin.
I hope I am not missing something very simple here. I have done a
I have a very simple ajax request: $.get(url, data) .done(function () { }) .fail(function
I have very little knowledge of generics other than how to 'use them'. In
I have some experience with programming, but I have very little experience when it
Although only having done a very little in C++ before I'm trying to compile

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.