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
2
votes
2 answers

C/C++ I18N mbstowcs question

I am working on internationalizing the input for a C/C++ application. I have currently hit an issue with converting from a multi-byte string to wide character string. The code needs to be cross platform compatible, so I am using mbstowcs and…
bogertron
  • 2,255
  • 1
  • 24
  • 36
2
votes
2 answers

How to print wide character using JNI

On a 32-bit Ubuntu machine, from JDK 1.7.0, I'm unable to print wide characters. Here is my code: JNIFoo.java public class JNIFoo { public native void nativeFoo(); static { System.loadLibrary("foo"); } …
dalf
  • 582
  • 4
  • 11
2
votes
0 answers

C++ - cast defined string to wide string (L prefix)

Lets say I have defined string : #define MY_STRING "This is my string" However some functions require my string to have an L prefix (extended format). Of course I could make another macro #define MY_STRING_LONG L"This is my string" But that…
Dan
  • 221
  • 1
  • 4
  • 12
2
votes
1 answer

String conversion from System::String ^ to const wchar_t *

I'm trying to open a file using a string parameter, however I'm getting the following error: error C2664: 'void std::basic_ifstream<_Elem,_Traits>::open(const wchar_t *,std::ios_base::openmode,int)' : cannot convert parameter 1 from 'System::String…
user2990515
  • 93
  • 2
  • 6
2
votes
1 answer

BCP queryout -w generating wrong CSV File

I'm trying to generate a CSV file with BCP. My problem is that I have some NVARCHAR columns so I must use the parameter -w for the bcp utility. So, the CSV file generated is opening in a single column in EXCEL. If I create a new text file copy the…
Rafael
  • 31
  • 4
2
votes
0 answers

Why can't it print out the character encoded in Shift-JIS?

#include #include #include int main (void) { setlocale(LC_ALL, "ja_JP.Shift_JIS"); char Str[3] = {0x82,0xCC,'\0'}; printf ("(%ls)\n", Str); // --> A wprintf (L"(%ls) \n", Str); // --> B …
Kevin Dong
  • 5,001
  • 9
  • 29
  • 62
2
votes
2 answers

Echoing one wide character in the current locale encoding from stdin back to the stdout

The following simple code is supposed to read one wide char from stdin and echo it back to stdout, except that it dies of SIGSEGV on the iconv() call. The question is – what's wrong with the code? #include /* STDIN_FILENO */ #include…
Witiko
  • 3,167
  • 3
  • 25
  • 43
2
votes
1 answer

Makes sense to use wchar_t/wmain in a windows c++ console application?

I have been writing a new command line application in C++. One platform we support is, of course, Windows. The Windows console, by default, uses the OEM code pages depending on the locale (for example, on my machine it is CP437 / DOS.Western). I…
Kiran M N
  • 424
  • 1
  • 6
  • 15
2
votes
2 answers

Incompatible char and widechar in Delphi

I have a strange problem. I'm using Delphi 2007 and running it with the -r switch. On my computer everything works fine. When I transfer code to another computer I get an error: Incompatible types char and widechar. Maybe I should change some…
user1969258
  • 99
  • 2
  • 7
1
vote
1 answer

Only some unicode characters work with ncurses

I'm using ncurses 6.3, installed on OSX 12.0.1. My program is: #define NCURSES_WIDECHAR 1 #include #include int main() { setlocale(LC_ALL, ""); initscr(); // prints fine. Even the red heart, which is multiple…
Ned Ruggeri
  • 1,058
  • 2
  • 8
  • 13
1
vote
1 answer

Cant compare wide characters | C++

If I read special characters from a file and then try to compare them (like with an if) it doesn't recognize them. std::wstring c; std::wifstream file; file.open("test.txt"); while (file) { wchar_t tmp = file.get(); …
Strox
  • 29
  • 4
1
vote
1 answer

Testing wchar_t* for convertable characters

I'm working on talking to a library that handles strings as wchar_t arrays. I need to convert these to char arrays so that I can hand them over to Python (using SWIG and Python's PyString_FromString function). Obviously not all wide characters can…
Derakon
  • 11
  • 1
1
vote
2 answers

Wide charectar in print for some Farsi text, but not others

I'm using Google Translate to convert some error codes into Farsi with Perl. Farsi is one such example, I've also found this issue in other languages---but for this discussion I'll stick to the single example: The translated text of "Geometry data…
KJ7LNW
  • 1,437
  • 5
  • 11
1
vote
3 answers

Duplicating wide-character string

I am trying to create an application in which I have a function where I am trying to duplicate a wide character string. I am currently using _wcsdup(), since it is a Windows application and everything is working fine for me. But I need to create a…
1
vote
0 answers

WCHAR not functioning properly in linux

I am trying to use wstring in a C++ program which is as follows:- #include using namespace std; const wstring NAME = L"STACKOVERFLOW"; int main() { wcout<