widechar Questions
8
Is there any reason why Java char primitive data type is 2 bytes unlike C which is 1 byte?
Thanks
3
Solved
I'm trying to understand how does printf work with wide characters (wchar_t).
I've made the following code samples :
Sample 1 :
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
...
1
Solved
When I try to print the copyright symbol © with printf or write, it works just fine:
#include <stdio.h>
int main(void)
{
printf("©\n");
}
#include <unistd.h>
int main(void)
{
w...
3
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
...
Farquhar asked 23/1, 2011 at 13:3
2
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 ...
Cr asked 2/6, 2018 at 14:23
3
Solved
I'm trying to read a wide char from a stream that was created using fmemopen with a char *.
char *s = "foo bar foo";
FILE *f = fmemopen(s,strlen(s),"r");
wchar_t c = getwc(f);
getwc throws a se...
Wismar asked 10/8, 2017 at 22:12
1
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 <iostream>
using std::cout;
int main()
{
cout << 'x...
1
Solved
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 ...
Docent asked 23/11, 2016 at 3:42
2
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 r...
4
Solved
I have a template class in C++ which takes as a char_type template parameter the character type, such as char, wchar_t, char32_t, etc... The class then use std::basic_string<char_type> in the...
1
Solved
I'm currently rewriting (a part of) the printf() function for a school project.
Overall, we were required to reproduce the behaviour of the function with several flags, conversions, length modifier...
3
Consider this sample program:
#include <cstdio>
#include <cwchar>
#include <string>
int main()
{
std::string narrowstr = "narrow";
std::wstring widestr = L"wide&...
2
Solved
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 poi...
2
Solved
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...
2
Solved
I am in the process of making a small program that reads a file, that contains UTF-8 elements, char by char. After reading a char it compares it with a few other characters and if there is a match ...
2
Solved
I came across this in the book:
wscanf(L"%lf", &variable);
where the first parameter is of type of wchar_t *.
This s different from scanf("%lf", &variable); where the first parameter is...
2
Solved
2
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 som...
France asked 22/11, 2011 at 22:23
5
Solved
2
Solved
I'm upgrading some ancient (from 2003) Delphi code to Delphi Architect XE and I'm running into a few problems. I am getting a number of errors where there are incompatible types. These errors don't...
4
Solved
I'm not quite pro with encodings, but here's what I think I know (though it may be wrong):
ASCII is a 7-bit, fixed-length encoding, with the characters you can find in ASCII charts.
UTF8 is an 8-...
Defazio asked 4/1, 2011 at 9:45
2
1
Solved
My code is basically this:
wstring japan = L"日本";
wstring message = L"Welcome! Japan is ";
message += japan;
wprintf(message.c_str());
I'm wishing to use wide strings but I do not know how the...
Oswell asked 28/6, 2010 at 6:13
4
Solved
I need to put WCHAR[] to std::cout ... It is a part of PWLAN_CONNECTION_NOTIFICATION_DATA passed from Native Wifi API callback.
I tried simply std::cout << var; but it prints out the numeri...
1
© 2022 - 2024 — McMap. All rights reserved.