Recent

Author Topic: lost some symbols at end of string  (Read 1142 times)

oddfish49

  • Newbie
  • Posts: 4
lost some symbols at end of string
« on: June 02, 2020, 07:53:53 pm »
Hello!
I have intristing bug:
...
var
  Form1: TForm1;
  CompileCommand: string = 'ABC-РН';
...
      CompileCommand := Registry.ReadString('ComputerName');
  finally
    Edit1.Text := CompileCommand;
Edit1.Text look as: ABC-?
2 last symbols are russian.
Run this program with Delphi looks true.
Anybody, Help me please.

« Last Edit: June 02, 2020, 08:16:28 pm by oddfish49 »

ASerge

  • Hero Member
  • *****
  • Posts: 2249
Re: lost some symbols at end of string
« Reply #1 on: June 02, 2020, 08:38:08 pm »
var
  Form1: TForm1;
  CompileCommand: string = 'ABC-РН';
...
Edit1.Text look as: ABC-?
2 last symbols are russian.
Simple test. What is shown in the Edit for such a code:
Code: Pascal  [Select][+][-]
  1. var
  2.   CompileCommand: string = 'ABC-РН';
  3.  
  4. procedure TForm1.Button1Click(Sender: TObject);
  5. begin
  6.   Edit1.Text := CompileCommand;
  7. end;

oddfish49

  • Newbie
  • Posts: 4
Re: lost some symbols at end of string
« Reply #2 on: June 02, 2020, 08:44:12 pm »
True string: ABC-РН

ASerge

  • Hero Member
  • *****
  • Posts: 2249
Re: lost some symbols at end of string
« Reply #3 on: June 02, 2020, 08:51:19 pm »
True string: ABC-РН
So the error is somewhere else. For example, it is read from the registry or somewhere else. There is no code.

oddfish49

  • Newbie
  • Posts: 4
Re: lost some symbols at end of string
« Reply #4 on: June 02, 2020, 08:57:58 pm »
So, but this code at Delphi working true. And Register not modified.

paweld

  • Hero Member
  • *****
  • Posts: 1003
Re: lost some symbols at end of string
« Reply #5 on: June 02, 2020, 09:19:09 pm »
Try:
Code: Pascal  [Select][+][-]
  1. uses
  2.   ..., LConvEncoding;
  3.  
  4. ...
  5.   CompileCommand := WinCPToUTF8(Registry.ReadString('ComputerName'));
  6. ...
Best regards / Pozdrawiam
paweld

oddfish49

  • Newbie
  • Posts: 4
Re: lost some symbols at end of string
« Reply #6 on: June 02, 2020, 09:55:35 pm »
Thank you very much. All OK. 10 years not use windows and fogot any things
Thank you once more

 

TinyPortal © 2005-2018