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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:08:08+00:00 2026-05-17T19:08:08+00:00

std::stringstream stream_french; stream_french.imbue(std::locale()); // French_France.1252 stream_french << 1000; std::string value_french = stream_french.str(); This code

  • 0
std::stringstream stream_french;
stream_french.imbue(std::locale("")); // French_France.1252
stream_french << 1000;
std::string value_french = stream_french.str();

This code will convert 1000 to string “1 000” but the value of value_french[1] is -96 and not 32, why is that ?

value_french[0] = 49
value_french[1] = -96 
value_french[2] = 48
value_french[3] = 48 
value_french[3] = 48

If I do

stream_french << "1 000";

The value of value_french[1] is 32. The error seems to be related to the signedess of char, but why is it only affecting white spaces when doing conversions ?

  • 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-17T19:08:09+00:00Added an answer on May 17, 2026 at 7:08 pm

    That -96 is the signed equivalent of 160, i.e. 0xA0; if you go and check the Windows 1252 codepage table, you’ll see that such character is

    A0 = U+00A0 : NO-BREAK SPACE

    which is a space that don’t allow an automatic line break:

    Text-processing software typically assumes that an automatic line break may be inserted anywhere a space character occurs; a non-breaking space prevents this happening (provided the software recognises the character, of course). For example, if the text “100 km” will not quite fit at the end of a line, the software may insert a line break between “100” and “km”. To avoid this undesirable behaviour, the editor may choose to use a non-breaking space between “100” and “km”. This guarantees that the text “100 km” will not be broken: if it does not fit at the end of a line it is moved in its entirety to the next line.

    As with “100 km”, also with “1 000” it’s clear that it’s not desirable to have a line break between the 1 and the three 0, so a non-breaking space is used; quite clever indeed.

    To make it definitely clear: with a “normal” space:

    1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000

    with a non-breaking space:

    1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000 1 000

    (if you don’t see any difference, try to zoom in/out with the font size of the browser)

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

Sidebar

Related Questions

How do I convert from std::stringstream to std::string in C++? Do I need to
For an std::map<std::string, std::string> variables , I'd like to do this: BOOST_CHECK_EQUAL(variables[a], b); The
I've tried several things already, std::stringstream m; m.empty(); m.clear(); both of which don't work.
For std::map, how will insert behave if it has to resize the container and
Is std::string size() a O(1) operation? The implementation of STL I'm using is the
I want to output an integer to a std::stringstream with the equivalent format of
Is there a simple way of creating a std::string out of an const char[]
I want to write to a std::stringstream without any transformation of, say line endings.
When would I use std::istringstream , std::ostringstream and std::stringstream and why shouldn't I just
Assuming the stream extraction won't fail, will this if( !(stream >> token) ) throw

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.