System.RawByteString
Delphi
RawByteString = type AnsiString($ffff);
C++
typedef System::AnsiStringT<65535> RawByteString;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
type typedef |
public | System.pas System.hpp |
System | System |
Description
Enables the passing of string data of any code page without doing any codepage conversions.
The purpose of RawByteString is to reduce the need for multiple overloads of procedures that read string data. This means that parameters of routines that process strings without regard for the string's code page should typically be of type RawByteString.
RawByteString should only be used as a parameter type, and only in routines which otherwise would need multiple overloads for AnsiStrings with different codepages. Such routines need to be written with care for the actual codepage of the string at run time.
In general, it is recommended that string processing routines should simply use "string" as the string type. Declaring variables or fields of type RawByteString should rarely, if ever, be done, because this practice can lead to undefined behavior and potential data loss.
See Also
- TBytes
- System.SetCodePage
- System.AnsiString
- System.Rtti.TRttiAnsiStringType.CodePage
- http://stackoverflow.com/questions/6061919/delphi-xe-rawbytestring-vs-ansistring
- Delphi in a Unicode World Part I: What is Unicode, Why do you need it, and How do you work with it in Delphi?
- Delphi in a Unicode World Part II: New RTL Features and Classes to Support Unicode