void MyFrame::LineEntry(wxCommandEvent& WXUNUSED(event))
{
wxTextEntryDialog dialog(this,
wxT("This is a small sample\n")
wxT("A long, long string to test out the text entrybox"),
wxT("Please enter a string"),
wxT("Default value"),
wxOK | wxCANCEL);
if (dialog.ShowModal() == wxID_OK)
{
wxString str = dialog.GetValue();
wxMessageBox(str, wxT("Got string"), wxOK | wxICON_INFORMATION, this);
wxCSConv cs(wxT("GB2312"));
printf("Got string = %s\n", (const char*)str.mb_str(cs));
}
On Tue, 25 Aug 2015 03:16:17 -0700 (PDT) Zhou Leo wrote:
wxCSConv cs(wxLocale::GetSystemEncoding());
In my system, wxLocale::GetSystemEncoding() reuturns wxFONTENCODING_MACCHINESESIMP, but the mb_str(cs) returns a empty string. If my method is wrong, could you tell me how I can get appropriate charset to construct wxLocale based on current OS, instead of specifying it directly. Thanks!
Leo
On Tue, 25 Aug 2015 08:18:10 -0700 (PDT) Zhou Leo wrote:
wxCSConv cs(wxLocale::GetSystemEncoding());
In my system, wxLocale::GetSystemEncoding() reuturns wxFONTENCODING_MACCHINESESIMP, but the mb_str(cs) returns a empty string. If my method is wrong, could you tell me how I can get appropriate charset to construct wxCSConv based on current OS, instead of specifying it directly. Thanks!