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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:46:29+00:00 2026-05-27T18:46:29+00:00

Here is a beginner question on Unicode. I’m using Embarcadero C++ Builder 2009, where

  • 0

Here is a beginner question on Unicode. I’m using Embarcadero C++ Builder 2009, where they supposedly changed the default strings to use Unicode.

  • I type various symbols in my source editor, that aren’t part of the standard “7-bit ASCII”.
  • My program is using the String type of C++ Builder to fetch user input.
  • I am also adding input manually by setting a value to a wchar_t.

It would seem that there are conflicts in how the symbols are interpreted. Sometimes I get a symbol with for example the code 0x00C7 (‘Ç’), but sometimes the same symbol is coded as 0xFFC7, for example in the source code editor. To my understanding, the former is proper Unicode, the latter is “something else”. Can someone confirm this?

I wonder where this “something else” encoding is coming from, and how to get rid of it?

EDIT: Further research: it seems that one place where the 0xFF** encoding appears is when I do something like this:

string str = ...;
wchar_t wch = (wchar_t)str[i];

Same result no matter if it is std::string or VCL String. Is wchar_t not the same as Unicode?

  • 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-27T18:46:29+00:00Added an answer on May 27, 2026 at 6:46 pm

    I’m guessing the problem is that in your compiler char is signed (the standard allows it to be either signed or unsigned, it’s implementation-defined/specific). As such, whenever you convert chars that have bit 7 set to 1 (0x80 through 0xFF) into any larger integer type, it’s treated as a negative value and it gets sign-extended to preserve the negative value, or, in other words, this bit 7 gets copied to bit 8, bit 9 and so on, into all higher bits of the bigger integer type. So, 0xC7 can turn into 0xFFC7 and 0xFFFFFFC7. To prevent that from happening, cast chars to unsigned chars first.

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

Sidebar

Related Questions

Okay here is a softball beginner WPF question. By default the background of the
Bit of a beginner question here: Say I have a block of xml: <root>
Once again a very beginner-ish question, but here I go: I would like to
A C++ beginner's question. Here is what I have currently: // From tchar.h #define
A beginner question here. My goal: to understand the design rationale behind this. When
Really beginner question here. I have an NSArray of images which in its last
Beginner question here. I'm going to make a Jquery function that is used to
beginner question. here's pdb output (Pdb) entry.image <FieldFile: None> (Pdb) entry.image is None False
I came here to ask a simple, very beginner question regarding python. I just
Beginner here: In this answer to my question of how to insert data into

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.