* use the current legacy console code page in Enhanced2Legacy

git-svn-id: branches/unicodekvm@48915 -
This commit is contained in:
nickysn 2021-03-08 17:34:36 +00:00
parent c6bce8915f
commit 77279fb5ef

View File

@ -306,14 +306,14 @@ begin
end; end;
end; end;
function ExtendedGraphemeCluster2LegacyChar(const EGC: UnicodeString): Char; function ExtendedGraphemeCluster2LegacyChar(const EGC: UnicodeString; CodePage: TSystemCodePage): Char;
function GenConvert: Char; function GenConvert: Char;
var var
tmpS: RawByteString; tmpS: RawByteString;
begin begin
tmpS:=UTF8Encode(EGC); tmpS:=UTF8Encode(EGC);
System.SetCodePage(tmpS,CP_OEMCP,True); System.SetCodePage(tmpS,CodePage,True);
if Length(tmpS)=1 then if Length(tmpS)=1 then
Result:=tmpS[1] Result:=tmpS[1]
else else
@ -364,14 +364,16 @@ end;
procedure Enhanced2Legacy; procedure Enhanced2Legacy;
var var
I: Integer; I: Integer;
CodePage: TSystemCodePage;
begin begin
CodePage:=GetActiveCodePage();
{ todo: optimize this } { todo: optimize this }
for I := 0 to Length(EnhancedVideoBuf)-1 do for I := 0 to Length(EnhancedVideoBuf)-1 do
begin begin
with EnhancedVideoBuf[I] do with EnhancedVideoBuf[I] do
VideoBuf^[I]:=(Attribute shl 8) or Ord(ExtendedGraphemeCluster2LegacyChar(ExtendedGraphemeCluster)); VideoBuf^[I]:=(Attribute shl 8) or Ord(ExtendedGraphemeCluster2LegacyChar(ExtendedGraphemeCluster,CodePage));
with OldEnhancedVideoBuf[I] do with OldEnhancedVideoBuf[I] do
OldVideoBuf^[I]:=(Attribute shl 8) or Ord(ExtendedGraphemeCluster2LegacyChar(ExtendedGraphemeCluster)); OldVideoBuf^[I]:=(Attribute shl 8) or Ord(ExtendedGraphemeCluster2LegacyChar(ExtendedGraphemeCluster,CodePage));
end; end;
end; end;