[fpc-devel] Controlling the output of the widestring manager

Florian Klaempfl florian at freepascal.org
Sun Dec 2 20:40:10 CET 2007


Felipe Monteiro de Carvalho schrieb:
> On Dec 2, 2007 12:27 PM, Florian Klaempfl <florian at freepascal.org> wrote:
>> No. The rtl assumes that ansistrings always use the encoding used by the
>> system.
> 
> And what if utf-8 is the system encoding? Which is the case on many unixes.

Then ansistrings are utf-8 encoded of course. What's the problem with this?

> 
> Not to mention that on this case AnsiStrUpper already doesn't work.
> 

Well, unix people don't seem to care about completing the cwstring unit
:) BTW: for other encodings it doesn't work either on unix ...

Procedure SetCWideStringManager;
Var
  CWideStringManager : TWideStringManager;
begin
  CWideStringManager:=widestringmanager;
  With CWideStringManager do
    begin
      Wide2AnsiMoveProc:=@Wide2AnsiMove;
      Ansi2WideMoveProc:=@Ansi2WideMove;

      UpperWideStringProc:=@UpperWideString;
      LowerWideStringProc:=@LowerWideString;

      CompareWideStringProc:=@CompareWideString;
      CompareTextWideStringProc:=@CompareTextWideString;
      {
      CharLengthPCharProc

      UpperAnsiStringProc
      LowerAnsiStringProc
      CompareStrAnsiStringProc
      CompareTextAnsiStringProc
      }
      StrCompAnsiStringProc:=@StrCompAnsi;
      {
      StrICompAnsiStringProc
      StrLCompAnsiStringProc
      StrLICompAnsiStringProc
      StrLowerAnsiStringProc
      StrUpperAnsiStringProc
      }
      ThreadInitProc:=@InitThread;
      ThreadFiniProc:=@FiniThread;
    end;
  SetWideStringManager(CWideStringManager);
end;

Some code commented ...



More information about the fpc-devel mailing list