That should be because of different implementations of that function for UNICODE and ANSI. By the way, it is crushing under Windows. Under Linux I am using it with UNICODE.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Probably. It throws an exception from wxWidgets-2.6.4/src/common/strconv.cpp line 240. And this line is something interesting (especially it's comment):
wxASSERT(szPos < szEnd); //something is _really_ screwed up if this rings true
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Aha! I believe it has a bug and expects line to be \0 terminated.
On strconv.cpp:243 it (as the comment says) tries to determine a length of a substring by sending a char* to MB2WC function, which has a while loop (strconv.cpp:444) on this char* checking that it's value is not zero and incrementing it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am not sure that this is only wxWidgets on Windows bug. I believe that it exists on Linux to, and the fact that is worked for you is just a matter of luck (there could be a spontaneous \0 in the RAM).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On wxd compiled with ansi (haven't tested with unicode) this code will crush an application with wxWidgets assertion failure:
new StaticText(this, std.string.toString(0));
Meanwhile this will not:
new StaticText(this, std.string.toString(0) ~ '\0');
As I understand, it crushes in wxc/common.h in class dstr on operator wxString.
can't reproduce with UNICODE, will need to try with ANSI
That should be because of different implementations of that function for UNICODE and ANSI. By the way, it is crushing under Windows. Under Linux I am using it with UNICODE.
testing with wxWidgets 2.6.4 ANSI (on Linux), it is normally using wxWidgets 2.8.9 UNICODE
maybe the wxWidgets UTF-8 support code is broken on Windows and needs a workaround ?
Probably. It throws an exception from wxWidgets-2.6.4/src/common/strconv.cpp line 240. And this line is something interesting (especially it's comment):
wxASSERT(szPos < szEnd); //something is _really_ screwed up if this rings true
Aha! I believe it has a bug and expects line to be \0 terminated.
On strconv.cpp:243 it (as the comment says) tries to determine a length of a substring by sending a char* to MB2WC function, which has a while loop (strconv.cpp:444) on this char* checking that it's value is not zero and incrementing it.
I am not sure that this is only wxWidgets on Windows bug. I believe that it exists on Linux to, and the fact that is worked for you is just a matter of luck (there could be a spontaneous \0 in the RAM).
No, seems like it crashes on Linux too, when running in the old ANSI mode.
Will need to come up with something else to convert UTF-8 to wxString...
terminated the input string now, by making yet another copy...