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.

180 questions
6
votes
1 answer

iostreams - Print `wchar_t` or `charXX_t` value as a character

If you feed a wchar_t, char16_t, or char32_t value to a narrow ostream, it will print the numeric value of the code point. #include using std::cout; int main() { cout << 'x' << L'x' << u'x' << U'x' << '\n'; } prints x120120120. This…
zwol
  • 121,956
  • 33
  • 219
  • 328
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,337
  • 7
  • 35
  • 64
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
  • 151
  • 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
1 answer

Why there are no "unsigned wchar_t" and "signed wchar_t" types?

The signedness of char is not standardized. Hence there are signed char and unsigned char types. Therefore functions which work with single character must use the argument type which can hold both signed char and unsigned char (this type was chosen…
Igor Liferenko
  • 1,283
  • 1
  • 7
  • 21
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,191
  • 13
  • 33
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
  • 847
  • 6
  • 14
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,512
  • 1
  • 18
  • 30
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
  • 24,271
  • 30
  • 100
  • 197
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
3 answers

wide version of __FUNCTION__ on linux

is there a way i can print __FUNCTION__ as a wide character on linux? the trick with the WIDEN doesn't work for me, the gcc compiler prints: error: ?L_FUNCTION_? was not declared in this scope any help? Thanks
sramij
  • 4,407
  • 5
  • 26
  • 51
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,062
  • 7
  • 34
  • 64
4
votes
2 answers

Converting C++ std::wstring to utf8 with std::codecvt_xxx

C++11 has tools to convert wide char strings std::wstring from/to utf8 representation: std::codecvt, std::codecvt_utf8, std::codecvt_utf8_utf16 etc. Which one is usable by Windows app to convert regular wide char Windows strings std::wstring to utf8…
Victor Mezrin
  • 2,696
  • 2
  • 28
  • 40
4
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
  • 2,073
  • 17
  • 31
4
votes
2 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
  • 445
  • 5
  • 16
1
2
3
11 12