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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:31:30+00:00 2026-06-18T22:31:30+00:00

I am writing a QT5 application (with QT Creator) which uses special characters like

  • 0

I am writing a QT5 application (with QT Creator) which uses special characters like zodiac signs. This code works perfectly fine on Linux Mint 14:

QString s = QString::fromUtf8(“\u2648”);

But when I compile it on Windows XP SP3 get a compiler warning which says that the current codepage is cp1252 and the character \u2648 cannot be converted. When I run the program this character is displayed as a question mark.

According to my system settings UTF8(codepage 65001) is installed on my Windows.

  • 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-06-18T22:31:31+00:00Added an answer on June 18, 2026 at 10:31 pm

    (Note, I have not tried this, and I don’t know which compiler you are using, and am completely unfamiliar with QT, so I could be wrong. The following is based on general knowledge about Unicode on Windows.)

    On Windows, 8-bit strings are generally assumed to be in the current codepage of the system (also called the “ANSI” codepage). This is never UTF-8. On your system, it’s apparently cp1252. So there are actually two things going wrong:

    1. You are specifying a Unicode character, which the compiler tries to covert to the correct codepage. On Windows, this results in a compile time error, because cp1252 doesn’t have a code point to represent u+2648.
    2. But assuming that the code would compile, it would still not work. You pass this string, which would be in in cp1251 to fromUtf8, which wants a UTF-8 string. As the string is not valid UTF-8, this would likely result in a runtime error.

    On your Linux system, both works “by accident”, because it uses UTF-8 for 8-bit strings.

    To get this right, specify the 8-bit string in UTF-8 right away:

    QString s = QString::fromUtf8("\xE2\x99\x88");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing a third-party javascript code which uses underscore.js and tries to avoid conflicts with
Writing documentation in html requires some code examples. What to do with characters that
Writing a shell script and I want to do something like this: cp myfile.ext
Writing a Reporting Service (2005) report My DataSet returns something like this: DESCRIPTION COUNT
Writing an application with command line interface and I would like to know at
Writing a Service that is running on IIS. Basically looks like this: void ProcessRequest(HttpContext
Writing the code below without dot notation, do I have this right? from: if(self.yellowViewController.view.superview
Writing floats to a CSV writes some of them like this: 2.0628800997782577e-05 c =
Writing a function I must declare input and output data types like this: int
Writing a Jabber client that uses Twisted Words. I would like to know an

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.