Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 02/28/22 in Posts

  1. pyscripter

    SynEdit just got a major uplift

    A new feature has been added: Scintilla like indicators.
  2. Fr0sT.Brutal

    A book about Object Pascal Style Guide

    Won't the style guide be like "1. Write some code 2. Launch formatter 3. Examine the result"? 😄 Then only naming stuff is left to learn
  3. TEncoding has a GetBytes() method that accepts PWideChar and PByte. Unfortunately it is "strict protected". So you would have to derive a class from TUTF8Encoding and then use that. Alternatively you can use the LocaleCharsFromUnicode system function. ByteCount := TEncoding.UTF8.GetByteCount(S); Buf := GlobalAllocPtr(0, ByteCount); if ByteCount > 0 then LocaleCharsFromUnicode(CP_UTF8, 0, PChar(S), Length(S), MarshaledAString(Buf), ByteCount, nil, nil); GlobalFreePtr(Buf); Example for a derived TUTF8Encoding class: type TUTF8EncodingEx = class(TUTF8Encoding) public // make the PWideChar/PByte methods public function GetByteCount(Chars: PWideChar; CharCount: Integer): Integer; override; function GetBytes(Chars: PWideChar; CharCount: Integer; Bytes: PByte; ByteCount: Integer): Integer; override; function GetCharCount(Bytes: PByte; ByteCount: Integer): Integer; override; function GetChars(Bytes: PByte; ByteCount: Integer; Chars: PWideChar; CharCount: Integer): Integer; override; end; { TUTF8EncodingEx } function TUTF8EncodingEx.GetByteCount(Chars: PWideChar; CharCount: Integer): Integer; begin Result := inherited GetByteCount(Chars, CharCount); end; function TUTF8EncodingEx.GetBytes(Chars: PWideChar; CharCount: Integer; Bytes: PByte; ByteCount: Integer): Integer; begin Result := inherited GetBytes(Chars, CharCount, Bytes, ByteCount); end; function TUTF8EncodingEx.GetCharCount(Bytes: PByte; ByteCount: Integer): Integer; begin Result := inherited GetCharCount(Bytes, ByteCount); end; function TUTF8EncodingEx.GetChars(Bytes: PByte; ByteCount: Integer; Chars: PWideChar; CharCount: Integer): Integer; begin Result := inherited GetChars(Bytes, ByteCount, Chars, CharCount); end; begin ByteCount := TEncoding.UTF8.GetByteCount(S); Buf := GlobalAllocPtr(0, ByteCount); if ByteCount > 0 then TUTF8EncodingEx(TEncoding.UTF8).GetBytes(PChar(S), Length(S), Buf, ByteCount); GlobalFreePtr(Buf); end;
  4. I set different levels when checking the password, that determine what data the execute events are allowed to access. I will check the sample works the same with GET and POST in a day or two. Angus
  5. Uwe Raabe

    wuppdi Welcome Page for Delphi 11 Alexandria?

    Only speculating, but perhaps the delay is due to some major overhaul in respect to this: VCL WelcomePage Making wuppdi Welcome Page a plugin for the new Delphi Welcome Page introduced in Delphi 11 may give us the best of both worlds.
  6. True, and that is something I should use a lot more, obviously. Knew about it, but... I guess it's a habit that went away when computers got faster.
  7. Uwe Raabe

    Updated Community Edition

    They probably all vanished in an empty except-end block.
  8. dummzeuch

    Virus? How odd.

    Welcome to assisted emailing, a new service brought to you by the people who invented the seat belt beep.
×