Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How do I make strings be single byte ASCII and not unicode?

+2 votes
asked Oct 27, 2021 by Tore Forsgren (140 points)

Noticed the system uses unicode to represent strings

const char* text = "Temp is 15 °C";

The ° -char is ASCII B0 but is stored utf-8 two byte C2 B0


1 Answer

0 votes
answered Oct 28, 2021 by Peter Minarik (79,800 points)

Actually, º is the ASCII character 167 (see here).

C, C++ stores strings as character arrays. The default interpretation for these strings is ASCII string, not Unicode. For Unicode, various converters should be used.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.