The C++11 `char16_t` standard type represents a character in UTF-16 encoding.
Questions tagged [char16-t]
36 questions
1
vote
0 answers
VS 2015 std::char_traits operations
At my workplace, we changed string type (which holds internationalized characters) for from std::wstring to std::u16string after VS 2015(Update 3) compiler upgrade.
Due to this, we are seeing loads of performance regressions such as this.
The…

Recker
- 1,915
- 25
- 55
1
vote
1 answer
How to use the new char16_t and u8 types?
c11 improve encoding support with built-in types for utf-8 utf-16 and utf-32.
However I was completely unable to find reference on using them in Standard functions. All I found is how to use them in c++11 not in C.
So how to printf a char32_t for…

user2284570
- 2,891
- 3
- 26
- 74
1
vote
1 answer
Copy a basic_string to vector
Please suggest an efficient way to copy bytes from a basic_string< char16_t> to vector< uint8_t>.
I am not concerned with the encoding, and just want to copy the bytes to the bytearray. It will later be interpreted with the correct encoding…

SkypeMeSM
- 3,197
- 8
- 43
- 61
1
vote
2 answers
How to find the built-in function to deal with char16_t in C?
Please tell what is the char16_t version for the String Manipulation Functions
such as:
http://www.tutorialspoint.com/ansi_c/c_function_references.htm
I found many references site, but no one mentioned that.
Especially for printing function, this is…

CL So
- 3,647
- 10
- 51
- 95
1
vote
2 answers
C++11 char16_t strstr and sprintf equivalent
Is there any equivalent function to strstr and sprintf for char16_t type?
Also, where could I find the remaining functions of char16_t?

doptimusprime
- 9,115
- 6
- 52
- 90
0
votes
1 answer
Linux - how to read from the console to char16_t buffer
I work on Linux. I have to read from the console to char16_t buffer. Currently my code looks like this:
char tempBuf[1024] = {0};
int readBytes = read(STDIN_FILENO, tempBuf, 1024);
char16_t* buf = convertToChar16(tempBuf, readBytes);
Inside the…

Irbis
- 1,432
- 1
- 13
- 39
0
votes
0 answers
How to convert char16_t to wchar_t to print out with wprintf
I am trying to write a function to convert a const char16_* to a const wchar_t* to use it in wprintf later on:
const wchar_t* wchart_from_char16(const char16_t*) {
???
}
int main(){
const char16_t* my = u"The Text I want to print";
const…

user3443063
- 1,455
- 4
- 23
- 37
0
votes
1 answer
How to convert command line arguments from char * argv[] to char16_t * argv[]
I have a main() on Linux that receives command line arguments as char**
int main(int argc ,char * argv[])
In my cross platform program I want to use the command line arguments as char16_t. Therefore I need to convert char->char16_t. How do I do…

user3443063
- 1,455
- 4
- 23
- 37
0
votes
1 answer
c++ how to convert wchar_t to char16_t
Convert between string, u16string & u32string
This post explains the opposite of my question. So I need to post a new question
I need to convert wchar_t to char16_t. I found a sample of doing the opposite ( char16_t -> wchar_t) here:
I am not…

user3443063
- 1,455
- 4
- 23
- 37
0
votes
0 answers
Cyrillic characters are not saved in char16_t under msvc with cmake build
I faced the following problem: when I try to save a Cyrillic character in the char16_t variable, I get a c2015 error (too many characters in constant). The most interesting thing is that it happens only when I build with MSVC via cmake. If I do it…

qwertyui
- 1
- 1
0
votes
1 answer
Looking for c++ equivalent for _wfindfirst for char16_t
I have filenames using char16_t characters:
char16_t Text[2560] = u"ThisIsTheFileName.txt";
char16_t const* Filename = Text;
How can I check if the file exists already? I know that I can do so for wchar_t using _wfindfirst(). But I need char16_t…

user3443063
- 1,455
- 4
- 23
- 37
0
votes
2 answers
Is there a function to concatenate two char16_t
There is the function wcsncat_s() for concatenating two wchar_t*:
errno_t wcsncat_s( wchar_t *restrict dest, rsize_t destsz, const wchar_t *restrict src, rsize_t count );
Is there an equivalent function for concatenating two char16_t?

user3443063
- 1,455
- 4
- 23
- 37
0
votes
0 answers
C++ convert wchar_t to char16_t and back
I have a program that is supposed to run on all platfotms. So I need to get rid of wchar_t and use char16_t instead. How can I convert wchar_t <-> char16_t For example how would I get to use wsclen() here?
wchar_t WT = L'Hello World! of…

user3443063
- 1,455
- 4
- 23
- 37
0
votes
0 answers
memcmp difference between gcc 10.3 and gcc 11.1 for char16_t
Im converting some tests that use the memcmp function and don't get the expected output. Now I've been trying to figure out why there is a difference in the windows vs linux output and I ended up on godbolt.org. There I played around with different…

Gert Kommer
- 1,163
- 2
- 22
- 49
0
votes
1 answer
Unknown Type name char16_t while compiling C code using a header that is used for C++ code
This is my header file,
sample.h
#pragma
#ifndef BASETYPES
#define BASETYPES
typedef char16_t WCHAR
#endif
This is my C code,
sample.c
WCHAR *name;
int main() {
}
The above header was initially used by only C++ code. Now I have a C code to…

Shaik Syed Ali
- 3,359
- 3
- 17
- 22