widestring

Local WideString variable debug error "Int3 DbgBreakPoint"

In C++Builder, I wrote the following code (in Button1Click handler), When I run in debug mode, I get the "Int3 DbgBreakPoint" (Stack corrupted?). This doesn't happen for AnsiSting (Maybe reference counting). WideString boshluq; boshluq=L" "; Is this normal? What do you suggest me to fix this code? ...

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 file("test.txt"); file << "A’B" ; file.close(); ==> A’B This code works wofstream file("test.txt"); f...

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 WordApplication1.Selection.TypeText(ADOQuery1Text.AsVariant); // TWideStringField WordApplication1.Selection.Ty...

Delphi: Is it necessary to convert string to WideString?

I found a Windows API function that performs "natural comparison" of strings. It is defined as follows: int StrCmpLogicalW( LPCWSTR psz1, LPCWSTR psz2 ); To use it in delphi, I declared it this way: interface function StrCmpLogicalW(psz1, psz2: PWideChar): integer; stdcall; implementation function StrCmpLogicalW; e...

Copy files with widestring path in C++

I'm having some trouble using wchar_t* strings for copying a file, how do I open them in C/C++ I need to use wide chars because the filenames are in unicode with different foreign languages. Thanks in advance. ...

Delphi 2006 system.delete for widestrings?

Hi all, is there a counterpart of the Delete procedure that could be used for widestrings? Or should I just use copy and concatenate the resulting WideStrings? ...

(Wide)String - storing in TFileStream, Delphi 7. What is the fastest way?

Hi, I'm using Delphi7 (non-unicode VCL), I need to store lots of WideStrings inside a TFileStream. I can't use TStringStream as the (wide)strings are mixed with binary data, the format is projected to speed up loading and writing the data ... However I believe that current way I'm loading/writing the strings might be a bottleneck of my ...

Delphi < 2009, unicode replacement for JvAppStorage.

I'm looking for the best option to store my application settings. I decided to write own class that inherits from TPersistent which would store all the config options available. Currently I'm looking for the best way to save it - and I found JvAppStorage which looked very promising (as I'm using JVCL in my project anyway...) but it doesn...

What is the best way to find wide string headaches such as L"%s"?

Here is an example of one of the headaches I mean: We have a multiplatform project that uses mostly Unicode strings for rendering text to the screen. On windows in VC++ the line: swprintf(swWideDest, LEN, L"%s is a wide string", swSomeWideString); compiles fine and prints the wide string into the other wide string. However, this sho...

Converting wide char string to lowercase in C++

How do I convert a wchar_t string from upper case to lower case in C++? The string contains a mixture of Japanese, Chinese, German and Greek characters. I thought about using towlower... http://msdn.microsoft.com/en-us/library/8h19t214%28VS.80%29.aspx .. but the documentation says that: The case conversion of towlower is locale-...

Case insensitive search in Unicode in C++ on Windows

I asked a similar question yesterday, but recognize that i need to rephase it in a different way. In short: In C++ on Windows, how do I do a case-insensitive search for a string (inside another string) when the strings are in unicode format (wide char, wchar_t), and I don't know the language of the strings. I just want to know whether t...

Combining wide string literal with string macro

I have a macro for a character string as follows: #define APPNAME "MyApp" Now I want to construct a wide string using this macro by doing something like: const wchar_t *AppProgID = APPNAME L".Document"; However, this generates a "concatenating mismatched strings" compilation error. Is there a way to convert the APPNAME macro to a ...

How do I convert System::WideString to a char* in C++ and vice versa?

I have a situation where I need to compare a char* with a WideString. How do I convert the WideString to a char* in C++? ...

Where is wctype in Visual C 2008 Express?

I'm porting 3rd party software from Linux to Windows using Visual C 2008 Express. I have trouble only with function `wctype'. It's declared in %VCDIR%/include/wctype.h file as follow: _MRTIMP2 wctype_t __cdecl wctype (const char *); But, when trying to link a have the following error: C:\test>cl test.c Microsoft (R) 32-bit C/C++ Op...

Delphi, string vs widestring memory usage issue, non-unicode VCL (D7)

Hi, I'm storing some classes with WideString parameters describing them (like name, description and some others). Now if I change all those WideStrings to simple "string" (I'm using alias actually so I have to change one line only), memory usage is about 5% bigger!! than previously... How is that possible, since each char of the string i...

widestring compatibility problem in Delphi

In a dll build with Delphi 2006 Foo(aPath: widestring); begin _rootPath := aPath; end; In an executable built with Delphi 2010 _Foo := GetProcAddress(FooModule,’Foo’); _Foo(‘123456’); Stepping into the dll, aPath = '123'. In fact any string I pass gets cut exactly in half. 1.) Why is my literal being halved? 2.) How do I fix it...

Delphi 2010 Wide functions vs. String functions

We're currently converting a Delphi 2007 project to Delphi 2010. We were already using Unicode (via WideStrings and TNT Unicode Controls). I was expecting to replace all Wide functions, e.g. WideUpperCase, with their equivalent, e.g. UpperCase, but they do not work the same way. For example, WideUpperCase works differently from UpperCas...

covert wide character strings to narrow

I have an C++ Windows Mobile 6 application that is converting a wide-character array to a narrow-character array. I have no problems going from narrow to wide, but when I go from wide to narrow, the conversion fails as in the example below: const char* testA = "This is a test"; std::wstringstream testW; testW << testA; NKDbgPrintfW( L"t...

2-byte (UCS-2) wide strings under GCC

Hi all, when porting my Visual C++ project to GCC, I found out that the wchar_t datatype is 4-byte UTF-32 by default. I could override that with a compiler option, but then the whole wcs* (wcslen, wcscmp, etc.) part of RTL is rendered unusable, since it assumes 4-byte wide strings. For now, I've reimplemented 5-6 of these functions fro...

trouble with boost::filesystem::wrecursive_directory_iterator

I'm trying to write a program to help me manage my iTunes library, including removing duplicates and cataloging certain things. At this point I'm still just trying to get it to walk through all the folders, and have run into a problem: I have a small amount of Japanese music, where the artist and/or album is written in Japanese characte...