[5.10 b3] ReadProgramString()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

[5.10 b3] ReadProgramString()

Post by Rescator »

This is kind of a bug...

To replicate try using Sox for windows, it's output seems to be ascii. ( http://sox.sourceforge.net/ )
If PureBasic is set to create a unicode program then the string returned with ReadProgramString() is cut off.
Compiling as Ascii and all is fine. But I assume a Ascii PB program would have issues with a unicode program outputting to stdout.

Possible solution?

Either make ReadProgramString() automatically convert the string,
or add a flag option to ReadProgramString() similar to PeekS().
WriteProgramString() might need a flag as well.

Ideally ReadProgramString() would be automatic and WriteProgramString() with a optional flag.

Also note that ReadProgramError() probably have the same ascii/unicode issue.

No idea if the same issue exists for Mac or Linux.

EDIT: Changed title as this is true for b3 as well.

PS! I'm trying to use the stats option in Sox which outputs audio stats to stderr (as ascii, yep, outch)
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: [5.10 b3] ReadProgramString()

Post by c4s »

Has already been posted as a feature request, here for example: ReadProgramError() & ReadProgramString() for Unicode (September 2010)
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Re: [5.10 b3] ReadProgramString()

Post by Rescator »

*doh* Should have recalled that, seeing as I posted in that thread. :?

Still. That was over 2 years ago, I'm not an elephant. :mrgreen:
And ProgramReadString() ProgramReadError() working sometimes/sometimes not is an issue. (no easy way to know if the other program is Unicode or not).
So if it can't be fixed now, and it's unknown when it will be, then a note should be added in the manual hopefully.
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: [5.10 b3] ReadProgramString()

Post by jassing »

Considering that if someone uses notepad or some other editor, the potential is there to change the encoding from one to the other. Especially if the ini file is sent to another user for debugging.
Ultimately, the solution is to look at the file's encoding, and decode as appropriate, preferably automatically.
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Re: [5.10 b3] ReadProgramString()

Post by Rescator »

jassing wrote:Considering that if someone uses notepad or some other editor, the potential is there to change the encoding from one to the other. Especially if the ini file is sent to another user for debugging.
Ultimately, the solution is to look at the file's encoding, and decode as appropriate, preferably automatically.
ini file? Nobody mentioned ini files here, this is about ProgramReadString() and ProgramReadError() and unicode issues.
I think you are confusing this with ReadString()
Post Reply