Recent

Author Topic: [SOLVED]"Reading large output" and fileneme with special chars  (Read 1903 times)

bonmario

  • Sr. Member
  • ****
  • Posts: 346
[SOLVED]"Reading large output" and fileneme with special chars
« on: February 28, 2018, 12:12:23 pm »
Hi,
i'm using this example:
http://wiki.freepascal.org/Executing_External_Programs#Reading_large_output

In my directory, i have a file with name "Già inviati per email".
Running the example, that file name becames "Gi? inviati per email".

It's a bug?

I've attached the project



Thanks in advance, Mario


« Last Edit: March 02, 2018, 07:53:32 am by bonmario »

bigeno

  • Sr. Member
  • ****
  • Posts: 266
Re: "Reading large output" and fileneme with special chars
« Reply #1 on: February 28, 2018, 12:49:19 pm »
windows console have other encoding then GUI

bonmario

  • Sr. Member
  • ****
  • Posts: 346
Re: "Reading large output" and fileneme with special chars
« Reply #2 on: March 01, 2018, 08:17:32 am »
I also tried to convert it with "WinCPToUTF8", but the result is still wrong.

I had forgotten to write this information:
Lazarus 1.9.0 r57219 FPC 3.0.2 i386-win32-win32/win64


Hi, Mario

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12152
  • FPC developer.
Re: "Reading large output" and fileneme with special chars
« Reply #3 on: March 01, 2018, 08:47:25 am »
Console can also be in OEM encoding. But the in time TProcess must be redone using -W functions.

balazsszekely

  • Guest
Re: "Reading large output" and fileneme with special chars
« Reply #4 on: March 01, 2018, 09:22:09 am »
For Italian filenames this should do the trick:
Code: Pascal  [Select][+][-]
  1. Memo1.Lines.LoadFromStream(OutputStream);
  2. Memo1.Lines.Text := ConvertEncoding(Memo1.Lines.Text, GetConsoleTextEncoding, EncodingUTF8); //add this line
  3. OutputStream.Free;

bonmario

  • Sr. Member
  • ****
  • Posts: 346
Re: "Reading large output" and fileneme with special chars
« Reply #5 on: March 01, 2018, 10:21:20 am »
It work fine !!!

Thanks, Mario

 

TinyPortal © 2005-2018