[5.40]RunProgram() with #PB_UTF8

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Dadido3
User
User
Posts: 54
Joined: Sat Jan 12, 2008 11:50 pm
Location: Hessen, Germany
Contact:

[5.40]RunProgram() with #PB_UTF8

Post by Dadido3 »

Hi,

just a short bugreport, because it's late here:

When using RunProgram() in an unicode exectuable and you read data from stdin, it's interpreting everything as UTF-8.
That's nice, but the strange part is, that if you add the flag #PB_Program_UTF8 the functions seems to treat the data as #PB_Unicode and vice versa.

A simple example:

Code: Select all

Program = RunProgram("Someprogram.exe", "", "", #PB_Program_Open | #PB_Program_Read) ; Standard string format is UTF-8, as expected
Program = RunProgram("Someprogram.exe", "", "", #PB_Program_Open | #PB_Program_Read | #PB_Ascii) ; Standard string format is ASCII, as expected

Program = RunProgram("Someprogram.exe", "", "", #PB_Program_Open | #PB_Program_Read | #PB_UTF8) ; Standard string format is #PB_Unicode
Program = RunProgram("Someprogram.exe", "", "", #PB_Program_Open | #PB_Program_Read | #PB_Unicode) ; Standard string format is UTF-8
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [5.40]RunProgram() with #PB_UTF8

Post by Fred »

There problem here is you need to #PB_Program_UTF8, not #PB_UTF8. It's somewhat confusing I agree, so I will move it to feature request to change this in a future version.
User avatar
Dadido3
User
User
Posts: 54
Joined: Sat Jan 12, 2008 11:50 pm
Location: Hessen, Germany
Contact:

Re: [5.40]RunProgram() with #PB_UTF8

Post by Dadido3 »

Oh thanks.

I even wrote #PB_Program_UTF8 in the post, because i copied it out of the help, without noticing the additional "_Program" in there.

The moral of the story is "Never program after midnight" :)
Post Reply