Questions tagged [widechar]

widechar is a generic name for character sets wider than ASCII

The term widechar is a generic name for character sets wider than 8 bits. Generally this means some (unspecified) 16 or 32 bit Unicode encoding.

203 questions
7
votes
2 answers

wprintf: %p with NULL pointer

As I was writing a unit test, I stumbled upon some odd behavior from glibc, regarding "%p" and the NULL pointer. If I have a line such as printf("NULL pointer is %p\n", NULL);, then I see NULL pointer is (nil) printed to the screen, as I…
Drew McGowen
  • 11,471
  • 1
  • 31
  • 57
6
votes
1 answer

Why is © (the copyright symbol) replaced with (C) when using wprintf?

When I try to print the copyright symbol © with printf or write, it works just fine: #include int main(void) { printf("©\n"); } #include int main(void) { write(1, "©\n", 3); } Output: © But when I try to print it…
S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
6
votes
2 answers

_T( ) macro changes for UNICODE character data

I have UNICODE application where in we use _T(x) which is defined as follows. #if defined(_UNICODE) #define _T(x) L ##x #else #define _T(x) x #endif I understand that L gets defined to wchar_t, which will be 4 bytes on any platform. Please correct…
Nagasai Sowmya
  • 271
  • 2
  • 3
  • 4
6
votes
2 answers

WideChar to Bytes?

I have simple question here. How to convert WideChar to 2xByte in Delphi - 7? I searched the internet and the StackOverflow but with no results...
Little Helper
  • 2,419
  • 9
  • 37
  • 67
5
votes
2 answers

WideChar display issue on Windows 7

I am developing a little application. The captions (text displayed on the Labels) with WideChars (Greek letters) are correct under Vista and Windows7 in almost every case, but in some cases (on some computers) I have only empty squares. The language…
Andras Kelemen
  • 161
  • 1
  • 1
  • 5
5
votes
2 answers

How do you safely declare a 16-bit string literal in C?

I'm aware that there is already a standard method by prefixing with L: wchar_t *test_literal = L"Test"; The problem is that wchar_t is not guaranteed to be 16-bits, but for my project, I need a 16-bit wchar_t. I'd also like to avoid the requirement…
user6754053
5
votes
2 answers

putwchar() can't diplay a wchar_t variable

Why printf() can display é (\u00E9 int UTF-16) and putwchar() can't ? And what is the right syntax to get putwchar displaying é correctly ? #include #include #include #include int main() { wint_t wc =…
noraj
  • 3,964
  • 1
  • 30
  • 38
5
votes
3 answers

How could I guarantee a terminal has Unicode/wide character support with NCURSES?

I am developing an NCURSES application for a little TUI (text user interface) exercise. Unfortunately, I do not have the option of using the ever-so-wonderful-and-faithful ASCII. My program uses a LOT of Unicode box drawing characters. My program…
Mason Watmough
  • 495
  • 6
  • 19
5
votes
2 answers

Is there a reason for any C or C++ compiler to not define wctrans_t and wctype_t as the type wchar_t?

Actually, I'm working on a comparison of data types between programming languages, and here is my problem when reading the C and C++ standards. Quoted from C11, wctrans_t is a scalar type that can hold values which represent locale-specific…
Astaroth
  • 2,241
  • 18
  • 35
5
votes
1 answer

How does gcc decide the wide character set when calling `mbtowc()`?

According to the gcc manual, the option -fwide-exec-charset specifies the wide character set of wide string and character constants at compile time. But what is the wide character set when converting a multi-byte character to a wide character by…
spockwang
  • 897
  • 1
  • 6
  • 15
4
votes
2 answers

in bash script, howto get the display-width of a String

I want a bash function to count for the String Width that will comsumed when display. because in my cases, String may contain some wide-charactors (e.g. Chinese). So I cannot just use the length of a string. function getDisplayWidth () { …
wuxb
  • 2,572
  • 1
  • 21
  • 30
4
votes
0 answers

How does the Windows terminal know if I wrote a wide character or a normal character?

I used _setmode(_fileno(stdout), _O_U8TEXT). I am trying to understand how wprintf() differs from printf(), so I am trying to understand the difference betweem putc() and fputwc(). I thought the difference was that fputwc() could write 1–2 bytes and…
Schilive
  • 187
  • 7
4
votes
3 answers

What's the difference between struct __stat64 and struct _stati64 on WIN32?

I'm working on some code that needs to run on every version of windows since WIN2000 and also needs to work with wide file paths. I need to call some variant of stat to get the file length. The file may be larger than 4GB. Here's the relevant…
vy32
  • 28,461
  • 37
  • 122
  • 246
4
votes
1 answer

Mixing std::wcout and std::cout makes errors, what is wrong?

Having been compiled using g++, the program below prints the std::wcout expression only. But if you uncomment the 8th row, it prints three expressions properly. I would like to know the cause of such strange behavior. #include #include…
user11321136
4
votes
1 answer

Trying to read wide char gives EOF

I've got a text file, foo.txt, with these contents: R⁸2 I had a large program reading it and doing things with each character, but it always received EOF when it hit the ⁸. Here's the relevant portions of the code: setlocale(LC_ALL,""); FILE *in =…
MD XF
  • 7,860
  • 7
  • 40
  • 71
1
2
3
13 14