[fpc-devel] SysUtils.GetEnvironmentVariable(String) still uses GetEnvironmentVariableA

Michael Van Canneyt michael at freepascal.org
Mon May 23 16:13:02 CEST 2016



The typecase will not help you, since the result is an ansistring.
The result will still be crippled.

The only solution for this is a unicode RTL.

Michael.

On Mon, 23 May 2016, Denis Kozlov wrote:

> P.S. A minor typo, GetEnvironmentVariableA should read
> GetEnvironmentStringsA.
>
>
> On 23 May 2016 at 13:31, Denis Kozlov <dezlov at gmail.com> wrote:
>
>> Hi,
>>
>> In FPC 3.0.0 and TRUNK for Windows:
>>> SysUtils.GetEnvironmentVariable(String) uses GetEnvironmentVariableA
>>> SysUtils.GetEnvironmentVariable(UnicodeString) uses
>> GetEnvironmentStringsW
>>
>> GetEnvironmentVariableA produces a result crippled by ANSI/OEM. Can it be
>> replaced with a simple typecast of UnicodeString based function:
>>
>> function GetEnvironmentVariable(const EnvVar: String): String;
>> begin
>>   Result := String(GetEnvironmentVariable(UnicodeString(EnvVar)));
>> end;
>>
>> Denis
>>
>



More information about the fpc-devel mailing list