|
From: Mark D. <mar...@zn...> - 2007-05-12 15:38:07
|
Hi,
I have a problem with module Wx::Perl::ProcessStream.
This reads the STDOUT from an external process executed using Wx::Process and Wx::ExecuteCommand.
To do this it, it does a 'readline' on the wxInputStream available via Wx::Process.
My problem is that the implementation of READLINE in Wx::InputStream works as follows:
read a char from the stream
append char to a wxString
return wxString if char == '\n'
This appears not to work if the output stream from the external process is, for example, UTF-8.
I *think* what perhaps should happen is
read a char from the stream
add it to a charbuffer
if char == '\n' {
convert charbuffer to a wxString ( method determined by wxWidgets unicode/ansi build macros )
return wxString
}
Alas, my C is too poor to implement / test this (I've tried :-( ) - I suspect it would be v.simple for anyone with adequate C skills.
I have a workaround for the Wx::Perl::ProcessStream module. In that I have stopped using readline and do 'read's on the wxInputStream in a perl loop with localised byte mode.
This seems to work.
I'm not sure if Wx::InputStream::READLINE needs changing or not. Any thoughts?
Mark
|