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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:22:28+00:00 2026-06-17T07:22:28+00:00

I saw this post on Jon Skeet’s blog where he talks about string reversing.

  • 0

I saw this post on Jon Skeet’s blog where he talks about string reversing. I wanted to try the example he showed myself, but it seems to work… which leads me to believe that I have no idea how to create a string that contains a surrogate pair which will actually cause the string reversal to fail. How does one actually go about creating a string with a surrogate pair in it so that I can see the failure myself?

  • 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-06-17T07:22:29+00:00Added an answer on June 17, 2026 at 7:22 am

    The term “surrogate pair” refers to a means of encoding Unicode characters with high code-points in the UTF-16 encoding scheme (see this page for more information);

    In the Unicode character encoding, characters are mapped to values between 0x000000 and 0x10FFFF. Internally, a UTF-16 encoding scheme is used to store strings of Unicode text in which two-byte (16-bit) code sequences are considered. Since two bytes can only contain the range of characters from 0x0000 to 0xFFFF, some additional complexity is used to store values above this range (0x010000 to 0x10FFFF).

    This is done using pairs of code points known as surrogates. The surrogate characters are classified in two distinct ranges known as low surrogates and high surrogates, depending on whether they are allowed at the start or the end of the two-code sequence.

    Try this yourself:

    String surrogate = "abc" + Char.ConvertFromUtf32(Int32.Parse("2A601", NumberStyles.HexNumber)) + "def";
    
    Char[] surrogateArray = surrogate.ToCharArray();
    Array.Reverse(surrogateArray);
    
    String surrogateReversed = new String(surrogateArray);
    

    or this, if you want to stick with the blog example:

    String surrogate = "Les Mise" + Char.ConvertFromUtf32(Int32.Parse("0301", NumberStyles.HexNumber)) + "rables";
    
    Char[] surrogateArray = surrogate.ToCharArray();
    Array.Reverse(surrogateArray);
    
    String surrogateReversed = new String(surrogateArray);
    

    nnd then check the string values with the debugger. Jon Skeet is damn right… strings and dates seem easy but they are absolutely NOT.

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

Sidebar

Related Questions

I saw this post Linq int to string , and tried it var personalInfoQuery
Saw this post at CodeProject for FCKEditor. Can someone explain what about the new
I saw this post about using the new holographic themes on Honeycomb: Change theme
I saw this code snippet which talks about how to group socket connections from
I saw this post: Typos… Just use option strict and explicit please.. during one
I saw this post on Sitepoint quoting a statement by Rasmus Lerdorf which goes
So I saw this post which helped answer part of my question however now
I saw in this post a solution that fits exactly my needs https://stackoverflow.com/a/8858815/1462911 .
I look up a lot through this problem while i saw many post abt
I saw this as an example on MDN and didn't understand why this was

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.