@@ -1108,6 +1108,7 @@ begin
len:=UnicodeToUTF8(Nil, hp, 0);
SetLength(Result, len);
UnicodeToUTF8(PChar(Result), hp, len);
+ SetCodePage(RawByteString(Result),CP_UTF8,false);
end;
@@ -66,11 +66,11 @@ begin
Result:='';
while assigned(EP^) and (Index>1) do
begin
- Dec(Index);
- inc(EP);
+ dec(Index);
+ inc(EP);
- If Assigned(EP^) then
- Result:=StrPas(EP^);
+ if Assigned(EP^) then
+ Result:=EP^;
@@ -1026,13 +1026,16 @@ begin
hp:=p;
If (Hp<>Nil) then
- while (hp^<>#0) and (Index>1) do
+ while (hp^<>#0) and (Index>1) do
+ begin
+ Dec(Index);
+ hp:=hp+strlen(hp)+1;
+ end;
+ If (hp^<>#0) then
- hp:=hp+strlen(hp)+1;
+ Result:=HP;
+ SetCodePage(RawByteString(Result),CP_OEMCP,false);
- If (hp^<>#0) then
- Result:=StrPas(HP);
FreeEnvironmentStringsA(p);