Thank you, I believe I understand the situation.
To reproduce the problem...
- By [Tools+|Configure Tool] open [User-defined Tools] dialog.
- Click [New] to assign a new tool to [Tools+].
- Enter "TestApp" to both [Tool Name] and [Tools Menu Path] text boxes.
- Select "Tools Output Window" from [Output to] drop down list.
- Enter a file name of any console application which outputs other than ascii characters to stdout, to [Command line] text box.
- [OK] to close the dialog.
- Execute [Tools+|TestApp]
The TestApp could be the following for example. It outputs a UTF-8 string. The [wxWidgets Debug Alert] dialog pops up 21 times if you don't check the checkbox, because I think the string has 7 characters, all of which are 3 code length (3 bytes).
#include <iostream>
int main()
{
std::cout<<"\u3053\u3093\u306B\u3061\u306F\u4E16\u754C"<<std::endl;
return 0;
}
I believe the problem is in PipedProcessCtrl::SyncOutput(plugins\contrib\ToolsPlus\PipedProcessCtrl.cpp:152, CB17.12). wxString is constructed from a given string by wxString::FromAscii function which only handles ascii characters. Although I've not understood why the function is called for each byte.
Although I've not understood why the function is called for each byte.
OK, wxString::FromAscii does check each byte... (src\common\string.cpp:1161, wxWidgets 3.1.0)
wxString wxString::FromAscii(const char *ascii, size_t len)
{
if (!ascii || len == 0)
return wxEmptyString;
wxString res;
{
wxStringInternalBuffer buf(res, len);
wxStringCharType *dest = buf;
for ( ; len > 0; --len )
{
unsigned char c = (unsigned char)*ascii++;
wxASSERT_MSG( c < 0x80,
wxT("Non-ASCII value passed to FromAscii().") );
*dest++ = static_cast<wxStringCharType>(c);
}
}
return res;
}