#Printing a UTF-8 Unicode character using windows cmd c compiler.

9 messages · Page 1 of 1 (latest)

humble crystal
#

The character I would like to print is 'ə', using its unicode value '\u0259' because there is no ASCII 32 bits value for this character.
Attempting to print this code returns a warning then prints a question mark ('?').
I know this could be done easily in Python but I wish to use C because it is the one language I'm learning at school and the one language I'll be evaluated in this year.

What I would like to do is being able to print this character in cmd using c code, or any unicode character for that matter. Is there maybe some kind of library I can install to get UTF8 characters?

#include <stdio.h>
#include <stdlib.h>

void main (void)
{
    char myChar = '\u0259';  // Unicode value for "ə"
    printf("%c", myChar);
}

Compilation :

unicode.c
unicode.c(6): warning C4566: character represented by universal-character-name '\u0259' cannot be represented in the current code page (1252)
Microsoft (R) Incremental Linker Version 14.33.31630.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:unicode.exe
unicode.obj

C:\FILES\code\c\z>unicode
?
still sinewBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

glacial bluff
#

You teminal probably dosen't support the ə character

#

but if you really want it

#

just do

#
char str[] = "ə";
printf("%s", str);
still sinewBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.