ansistring

Assign [array of byte] to a Variant with no Unicode conversion

帅比萌擦擦* 提交于 2019-12-23 21:32:05
问题 Consider the following code snippet (in Delphi XE2): function PrepData(StrVal: string; Base64Val: AnsiString): OleVariant; begin Result := VarArrayCreate([0, 1], varVariant); Result[0] := StrVal; Result[1] := Base64Val; end; Base64Val is a binary value encoded as Base64 (so no null bytes). The ( OleVariant ) Result is automatically marshalled and sent between a client app and a DataSnap server. When I capture the traffic with Wireshark, I see that both StrVal and Base64Val are transferred as

Dll built in Delphi 2010/2009 not compatible to Delphi 7 when an Exception is raised

元气小坏坏 提交于 2019-12-22 16:59:27
问题 I've built a dll in Delphi 2010 and it's consumed in my delphi 7 application. I'm aware of the unicode AnsiString / string matter and according to my tests everything works fine up to the moment that no exception is raised by my delphi 2010 dll. The fact is, is there any special/treated exception that is compatible to the unicode/AnsiString world? That is, is my Delphi 2010 able to raise an exception that can be handled appropriately in my delphi 7 app? thanx for any help. Danilo. 回答1: Seeing

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

偶尔善良 提交于 2019-12-10 11:38:02
问题 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 of single-byte characters? string not so sure what it is... Not sure about the diferent kind of string types I have in Code Builder C++ 2007 available and its portability. 回答1: AnsiString is a class provided C++ Builder, std::string is class

Dll built in Delphi 2010/2009 not compatible to Delphi 7 when an Exception is raised

跟風遠走 提交于 2019-12-06 13:21:34
I've built a dll in Delphi 2010 and it's consumed in my delphi 7 application. I'm aware of the unicode AnsiString / string matter and according to my tests everything works fine up to the moment that no exception is raised by my delphi 2010 dll. The fact is, is there any special/treated exception that is compatible to the unicode/AnsiString world? That is, is my Delphi 2010 able to raise an exception that can be handled appropriately in my delphi 7 app? thanx for any help. Danilo. Seeing as both Mason and Jeroen prompted me, here goes: (Jeroen, don't drop yours, you have valid points as well).

Converting UTF8 to ANSI (ISO-8859-1) in Delphi

前提是你 提交于 2019-12-03 21:47:19
问题 I have a question about a code that i have to convert UTF8 strings to ANSI strings. My code works for accents in vowels, but with letter Ñ it doesn't work. The code breaks the string. How can I fix this mistake? The string I have in UTF8: EDIFICIO PEÑAS BLANCAS The string I would have in ANSI if correct: EDIFICIO PEÑAS BLANCAS The string I have in ANSI now: EDIFICIO PE The code is here: function TFormMain.convertir_utf8_ansi(const Source: string):string; var Iterator, SourceLength, FChar,

bds 2006 C hidden memory manager conflicts (class new / delete[] vs. AnsiString)

瘦欲@ 提交于 2019-11-26 00:38:39
问题 I am using BDS 2006 Turbo C++ for a long time now and some of my bigger projects ( CAD/CAM,3D gfx engines and Astronomic computations) occasionally throw an exception (for example once in 3-12 months of 24/7 heavy duty usage). After extensive debugging I found this: //code1: struct _s { int i; } // any struct _s *s=new _s[1024]; // dynamic allocation delete[] s; // free up memory this code is usually inside template where _s can be also class therefore delete[] this code should work properly,