[Lazarus] TProcess, UTF8, Windows
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Fri Apr 13 18:18:03 CEST 2012
Jürgen Hestermann schrieb:
> Mattias Gaertner schrieb:
>> Maybe the other process's output is not in console codepage.
>> Try
>> Memo1.Lines.Append(<text or variable>)
>> or
>> Memo1.Lines.Append(SysToUTF8(<text or variable>)).
>>
> I am always astonished that we have come so far already!
> Today programmers have to guess about coding of strings,
> they cannot find out in documentation or by identifier name.
> Only trial and error (the latter mostly when the program
> is in production use) can be used. That's what I call C style
> and is not what Niklaus Wirth had in mind.
>
> IMO it must be possible to predict the encoding of strings
> when writing the code (without running the program).
The Delphi Unicode solution: set the proper encoding in TFileStream (?
or TStringList), then the file is converted into UTF-16 on read, and
back again when written to disk. Then the coder has to deal only with
UnicodeStrings, and with AnsiStrings of codepage CP_ACP (system default)
if ever required.
DoDi
More information about the Lazarus
mailing list