Var

strAnsi: AnsiString; begi n strAnsi := 'Some text ';

46 Using Log (str) directly would work, as there is no concatenation involved.

strAnsi := strAnsi + AnsiChar (210) + AnsiChar (128);

Log ('String: " + strAnsi); Log ('CodePage: " + IntToStr (

StringCodePage (strAnsi))); Log ( 'Address: " + IntToStr ( Integer (Pointer (strAnsi))));

DisplayStringData (strAnsi); DisplayRawData (strAnsi); end;

The result will be as expected, since when calling the DisplayStringData and the DisplayRawData methods no conversions will be performed and all operations will take place in the exact same string:

String: Some text 0€ CodePage: 1252 Address: 28149532

DisplayStringData(str: AnsiString) String: Some text 0€ CodePage: 1252 Address: 28149532

DisplayRawData(str: RawByteString) String: Some text 0€ CodePage: 1252 Address: 28149532

If this looks obvious, it might not be so clear what happens when we pass a UTF8String as actual parameter to the methods. The calling code is quite similar, although I convert each single character treating it as a UTF-8 value:

Was this article helpful?

0 0
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment