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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:47:39+00:00 2026-05-16T02:47:39+00:00

Using strings in C++ development is always a bit more complicated than in languages

  • 0

Using strings in C++ development is always a bit more complicated than in languages like Java or scripting languages. I think some of the complexity comes from a performance focus in C++ and some is just historical.

I know of the following major string systems and would like to find out if there are others and what specific drawbacks they have vs. each other:

  • ICU : http://userguide.icu-project.org/strings#TOC-Using-Unicode-Strings-in-C-
  • GLib::ustring : http://library.gnome.org/devel/gtkmm-tutorial/unstable/sec-basics-ustring.html.en
  • MFC CString : http://msdn.microsoft.com/en-us/library/5bzxfsea%28VS.100%29.aspx
  • std::basic_string : http://en.cppreference.com/w/cpp/string/basic_string
  • QT QString : http://doc.qt.nokia.com/4.6/qstring.html#details

I’ll admit that there can be no definite answer, but I think SOs voting system in uniquely suited to show the preferences (and thus the validity of arguments) of people actually using a certain string system.


Added from answers:

  • UFT8-CPP : http://utfcpp.sourceforge.net/
  • 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-16T02:47:40+00:00Added an answer on May 16, 2026 at 2:47 am

    Using strings in C++ development is
    always a bit more complicated than in
    languages like Java or scripting
    languages. I think some of the
    complexity comes from a performance
    focus in C++ and some is just
    historical.

    I’d say it’s all historical. In particular, two pieces of history:

    • C was developed back in the days when everyone (even Japan) was using a 7-bit or 8-bit character encoding. Because of this, the concepts of char and “byte” are hopelessly confounded.
    • C++ programmers quickly recognized the desirability of having a string class rather than just raw char*. Unfortunately, they had to wait 15 years for one to be officially standardized. In the meantime, people wrote their own string classes that we’re still stuck with today.

    Anyhow, I’ve used two of the classes you mentioned:

    MFC CString

    MSDN documentation

    There are actually two CString classes: CStringA uses char with “ANSI” encoding, and CStringW uses wchar_t with UTF-16 encoding. CString is a typedef of one of them depending on a preprocessor macro. (Lots of things in Windows come in “ANSI” and “Unicode” versions.)

    You could use UTF-8 for the char-based version, but this has the problem that Microsoft refuses to support “UTF-8” as an ANSI code page. Thus, functions like Trim(const char* pszTargets), which depend on being able to recognize character boundaries, won’t work correctly if you use them with non-ASCII characters.

    Since UTF-16 is natively supported, you’ll probably prefer the wchar_t-based version.

    Both CString classes have a fairly convenient interface, including a printf-like Format function. Plus the ability to pass CString objects to this varags function, due to the way the class is implemented.

    The main disadvantages are:

    • Slow performance for very large strings. (Last I checked, anyway.)
    • Lack of integration with the C++ standard library. No iterators, not even << and >> for streams.
    • It’s Windows-only.

    (That last point has caused me much frustration since I got put in charge of porting our code to Linux. Our company wrote our own string class that’s a clone of CString but cross-platform.)

    std::basic_string

    The good thing about basic_string is that it’s the standard.

    The bad thing about it is that it doesn’t have Unicode support. OTOH, it doesn’t actively not support Unicode, as it lacks member functions like upper() / lower() that would depend on the character encoding. In that sense, it’s really more of a “dynamic array of code units” than a “string”.

    There are libraries that let you use std::string with UTF-8, such as the above-mentioned UTF8-CPP and some of the functions in the Poco library.

    For which size characters to use, see std::wstring vs std::string.

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

Sidebar

Ask A Question

Stats

  • Questions 490k
  • Answers 490k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer 1) Yes then autocomplete can be accessed using PHP this… May 16, 2026 at 9:52 am
  • Editorial Team
    Editorial Team added an answer Consider: var results = test.match(/\S+\s*/g); That would guarantee you don't… May 16, 2026 at 9:52 am
  • Editorial Team
    Editorial Team added an answer Short answer: yes. SQLite databases are contained in one file,… May 16, 2026 at 9:52 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

There are various ways to maintain user state using in web development. These are
I used TDD as a development style on some projects in the past two
Is there a regex to calculate straight poker hand? I'm using strings to represent
I'm using unicode strings for non latin characters as key names for my models.
I am facing problem when comparing 2 strings values using C:When tag I am
How to receive strings from C# in Visual-C++ based .net DLL? In C++ (using
In our current codebase we are using MFC db classes to connect to DB2.
I am using jQuery to call web service (*.asmx) methods. The web service uses
I'm trying to send an email message using the .NET MailMessage class which can
I'm doing a home project that started off really easy (doesn't that always happen?)

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.