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

  • Home
  • SEARCH
  • 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 6242779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:01:08+00:00 2026-05-24T12:01:08+00:00

The project I’m currently working on needs to interface with a client system that

  • 0

The project I’m currently working on needs to interface with a client system that we don’t make, so we have no control over how data is sent either way. The problem is that were working in C#, which doesn’t seem to have any support for UCS-2 and very little support for big-endian. (as far as i can tell)

What I would like to know, is if there’s anything i looked over in .net, or something that someone else has made and released that we can use. If not I will take a crack at encoding/decoding it in a custom method, if that’s even possible.

But thanks for your time either way.

EDIT:
BigEndianUnicode does work to correctly decode the string, the problem was in receiving other data as big endian, so far using IPAddress.HostToNetworkOrder() as suggested elsewhere has allowed me to decode half of the string (Merli? is what comes up and it should be Merlin33069)

Im combing the short code to see if theres another length variable i missed

RESOLUTION:
after working out that the bigendian variables was the main problem, i went back through and reviewed the details and it seems that the length of the strings was sent in character counts, not byte counts (in utf it would seem a char is two bytes) all i needed to do was double it, and it worked out. thank you all for your help.

  • 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-24T12:01:09+00:00Added an answer on May 24, 2026 at 12:01 pm

    EDIT: Now we know that the problem isn’t in the encoding of the text data but in the encoding of the length. There are a few options:

    • Reverse the bytes and then use the built-in BitConverter code (which I assume is what you’re using now; that or BinaryReader)
    • Perform the conversion yourself using repeated “add and shift” operations
    • Use my EndianBitConverter or EndianBinaryReader classes from MiscUtil, which are like BitConverter and BinaryReader, but let you specify the endianness.

    You may be looking for Encoding.BigEndianUnicode. That’s the big-endian UTF-16 encoding, which isn’t strictly speaking the same as UCS-2 (as pointed out by Marc) but should be fine unless you give it strings including characters outside the BMP (i.e. above U+FFFF), which can’t be represented in UCS-2 but are represented in UTF-16.

    From the Wikipedia page:

    The older UCS-2 (2-byte Universal Character Set) is a similar character encoding that was superseded by UTF-16 in version 2.0 of the Unicode standard in July 1996.2 It produces a fixed-length format by simply using the code point as the 16-bit code unit and produces exactly the same result as UTF-16 for 96.9% of all the code points in the range 0-0xFFFF, including all characters that had been assigned a value at that time.

    I find it highly unlikely that the client system is sending you characters where there’s a difference (which is basically the surrogate pairs, which are permanently reserved for that use anyway).

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

Sidebar

Related Questions

project type is MVC2. Let say that i have page1. after success it write
project: Using VB.NET to build a winforms database interface and work-automation app. I am
project: Using VB.NET to build a winforms database interface and work-automation app. I am
Project type: Asp MVC 2/NHibernate/C# Problem If you have an edit page in an
I have a bunch of posts stored in text files formatted in yaml/textile (from
Project Lombok makes it trivial to implement the boilerplate code in the classes. Is
Project : Game in Flex builder 4 (Actionscript Project) Language : Actionscript 3 This
Project A - Web Application/Website Project B - Unit Test Application I'm familiar how
Project (id) Permission (project_id, user_id) When user's create a project, I want to ensure
[project_select] UserID (fk) | project_id (fk) | project_category_id (fk) [project_category] project_category_id | category [projects]

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.