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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:34:44+00:00 2026-05-13T14:34:44+00:00

The history of Encoding Schemes / multiple Operating Systems and Endian-nes have led to

  • 0

The history of Encoding Schemes / multiple Operating Systems and Endian-nes have led to a mess in terms of encoding all forms of string data (–i.e., all alphabets); for this reason protocol buffers only deals with ASCII or UTF-8 in its string types, and I can’t see any polymorphic overloads that accept the C++ wstring. The question then is how is one expected to get a UTF-16 string into a protocol buffer ?

Presumably I need to keep the data as a wstring in my application code and then perform a UTF-8 conversion before I stuff it into (or extract from) the message. What is the simplest – Windows/Linux portable way to do this (A single function call from a well-supported library would make my day) ?

Data will originate from various web-servers (Linux and windows) and will eventually ends up in SQL Server (and possibly other end points).

— edit 1–

Mark Wilkins suggestion seems to fit the bill, perhaps someone who has experience with the library can post a code snippet — from wstring to UTF-8 — so that I can gauge how easy it will be.

— edit 2 —

sth’s suggestion even more so. I will investigate boost serialization further.

  • 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-13T14:34:45+00:00Added an answer on May 13, 2026 at 2:34 pm

    It may be overkill, but the ICU libraries will do everything you need and you can use them on both Windows and Linux.

    However, if you are only wanting conversion, then under Windows, a simple call to MultiByteToWideChar and WideCharToMultiByte can do the conversion between UTF-8 and

    UTF-16. For example:

    // utf-8 to utf-16
    MultiByteToWideChar( CP_UTF8, 0, myUtf8String, -1,
                         myUtf16Buf, lengthOfUtf16Buf );
    

    With Linux, libidn might do what you need. It can convert between UTF-8 and UCS, which I think is equivalent to UTF-32 at some level. For example:

    // utf-8 to UCS
    ucsStr = stringprep_utf8_to_ucs4( "asdf", 4, &items );
    

    However, in Linux I think you might be best simply working with UTF-8. Unless you have an existing library for UTF-16, I am not sure there is a compelling reason to use it in Linux.

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

Sidebar

Related Questions

They share common history, they run on different operating systems. This is the part
I have an Address History table with three fields: EmpID , Address , AddrID
We have a history table that stores xml web service requests and responses. Currently
brief history. I have a little reporting tool that I am creating that uses
Does history.go(-1); behaves same in all browsers? I am seeing different behavior across various
I have this JSF table: <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC -//W3C//DTD XHTML
I have a clear history button which clears the data in plist. Now, loading
I am building a Winform web browser. I have a history.xml file which stores
I have this JSF table with pagination. <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC
In history-books you often have timeline, where events and periods are marked on a

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.