Questions tagged [widestring]

112 questions
2
votes
1 answer

Easiest Way to Transform a Wide String or Wide Character Array to a Simple Character Array?

My variable is in a specific internal implementation of a wide string but I can get it to be a wide character array quite easily. The problem is I need to feed it to a library function that will only accept character arrays. So I end up with what…
1
vote
1 answer

Definitions of: AnsiString, WideString, String, char[], char*, BSTR,

This is a followup to this question AnsiString is a class, too? And string? It is a class? And a char[]? Can we say a WideString is a wrapper over double-byte characters, AnsiString is a wrapper over single-byte characters, and char[] is an array…
Eduard
  • 664
  • 2
  • 14
  • 26
1
vote
2 answers

MS Word Ole Automation, ADO and foreign characters

I'm trying to export WideString texts from the database (ADO / MS Access) to the MS Word document (Delphi 7), but foreign characters are not correctly transferred (i.e. "è" instead of "č"): while not ADOQuery1.Eof do begin …
vrad
  • 836
  • 1
  • 7
  • 16
1
vote
2 answers

How to deal with the Unicode characters in C++

We have a commenting system built into our engine that allows programmers to put comments for various exposed variables/objects which are then used by the GUI front-end for tool-tips and help. Recently, certain tool-tips started crashing, and after…
Samaursa
  • 16,527
  • 21
  • 89
  • 160
1
vote
1 answer

Converting a wstring to jstring on Linux

I'm having problems converting a wstring to jstring in unix, as the size of wchar_t on linux in 4 bytes (not 2 bytes like windows and thus I cannot use the casting of a wchar_t to a jchar). Can anyone please help me with that? Thanks, Reza
RezaPlusPlus
  • 545
  • 1
  • 8
  • 18
1
vote
1 answer

how to correctly format WideString using sprintf or wprintf

I am using this code to format WideString but with no success! It prints unexpecting results :( here is my code WideString s; dep=new TStringList(); while(!DM->tDepPln->Eof) { //where tDepPlnFltNo is mysql field type of WideString …
Suhrob Samiev
  • 1,528
  • 1
  • 25
  • 57
1
vote
3 answers

Typographic apostrophe + wide string literal broke my wofstream (C++)

I’ve just encountered some strange behaviour when dealing with the ominous typographic apostrophe ( ’ ) – not the typewriter apostrophe ( ' ). Used with wide string literal, the apostrophe breaks wofstream. This code works ofstream…
singinanarchist
1
vote
0 answers

Use of c_str() for wstrings in c++

When I have a: std::string s I can do: s.c_str() to convert it to a char*. As I understand it only adds a '\0' to the end of s. Can I then conclude that just adding '\0' converts a string to a char*? Is doing something like that converting it to…
user3443063
  • 1,455
  • 4
  • 23
  • 37
1
vote
0 answers

C++ reading from file to std::wstring

#include #include #include int main() { std::wfstream file("../Data/books.txt", std::wios::in); std::vector lines; std::wstring line; while (!file.eof()) { std::getline(file,…
1
vote
0 answers

How does MSVC's STL open an fstream with a wide string filename?

Possible Duplicate: Opening fstream with file with Unicode file name under Windows using non-MSVC compiler I have been trying to find a simple way to open a file with non-ASCII characters in its filename in Windows with GCC. Microsoft's STL…
rubenvb
  • 74,642
  • 33
  • 187
  • 332
1
vote
1 answer

Pantheios wide characters?

I'm trying to integrate logging into my Windows C++ application, and I wanted to use Pantheios, as it generally has very favorable comments. That said, all the examples included are using macros like PANTHEIOS_LITERAL_STRING etc., for wrapping…
Mike Hornblade
  • 1,544
  • 2
  • 14
  • 19
1
vote
0 answers

Is passing a (Unicode) string to a WideString parameter safe?

Is it safe to pass a Delphi (Unicode) string to a procedure as a parameter of type WideString? procedure Test; var S: string; Html: string; begin S := '...'; // may contain anything a Unicode string accepts Html :=…
mjn
  • 36,362
  • 28
  • 176
  • 378
1
vote
2 answers

Using narrow string manipulation functions on wide data

I'm parsing an XML file which can contain localized strings in different languages (at the moment its just english and spanish, but in the future it could be any language), the API for the XML parser returns all data within the XML via a char* which…
Gruntcakes
  • 37,738
  • 44
  • 184
  • 378
1
vote
0 answers

A try to convert from char* to wchar_t* but doesn't work with non-English languages

I want to convert a string from char* to wchar_t* but that string is any language other than English for example (Russian, Chinese, Arabic, etc). I have tried to do that by the following: // This is just an example of conversion const wchar_t *…
Lion King
  • 32,851
  • 25
  • 81
  • 143
1
vote
0 answers

How to convert unicode strings to respective locale strings in cpp

I am reading unicode string from an XML file in C++ program and when i print the string i get the unicode printed as plain text instead of the decoded locale string.I initially tried it with plain string and then used widestring for decoding .Here…
user1
  • 53
  • 9