View Single Post
  #9  
Old 26-05-2017, 06:48
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 1,077
Thanks: 1,828
Thanked 2,311 Times in 789 Posts
Cesar82 is on a distinguished road
Help with the code...

Advanced users, I need help ...
I need help with with an adaptation of the code below to work inside the inno setup.

Code:
function ConvertLanguageName(Const Value: String): String;
var
  L: Integer;
  WideCharCode: Word;
  C: Char;
begin
  Result := '';
  L := 1;
  while L <= Length(Value) do
  begin
    if Value[L] = '<' then
    begin
      //WideCharCode := Ord( StrToInt('$' + Copy(Value, L + 1, 4)));
      WideCharCode :=  StrToInt('$' + Copy(Value, L + 1, 4));
      L := L + 6;
    end else begin
      WideCharCode := Ord(Value[L]);
      L := L + 1;
    end;
    C := Chr(WideCharCode);
    SetLength(Result, Length(Result) + 1);
    Result[Length(Result)] := C;
  end;
end;

function InitializeSetup(): Boolean;
begin
  MsgBox(ConvertLanguageName2('<0420><0443><0441><0441><043a><0438><0439>'), mbInformation, MB_OK); //Pусский
end;
This code compiled in Dephi 2009 Lite works perfectly, but if compiled in delphi 7 does not work. So far I've noticed that the Chr or Char function does not work correctly for unicode characters if compiled in Inno Setup or in Delphi 7. Compiling in Delphi 2009 works fine.

Delphi code to compare
https://mega.nz/#!sZYGWTJJ!WnaRzdNsz...c9XM9AqdwF60aA

Is there a way that works?
Thanks!
Reply With Quote