Hi all,

I have fixed the unicode problem (my previous post) by changing:

in  wxLua/modules/wxlua/include/wxlstate.h  function lua2wx and wx2lua like below

inline WXDLLIMPEXP_WXLUA wxString lua2wx(const char* luastr)
{
    if (luastr == NULL)
        return wxEmptyString;
#if wxUSE_UNICODE
  return wxString(luastr, wxConvUTF8);
#else
  return wxString(wxConvUTF8.cMB2WC(luastr), *wxConvCurrent);
#endif
    //return wxConvertMB2WX(luastr); // this fails on NULL
}

inline const WXDLLIMPEXP_WXLUA wxCharBuffer wx2lua(const wxString& wxstr)
{
    //wxCharBuffer buffer(wxConvertWX2MB(wxstr.c_str())); // origin
    // wxCharBuffer buffer=wxstr.mb_str(wxConvUTF8); // skieu
    wxCharBuffer buffer=wxConvUTF8.cWC2MB(wxstr.wc_str(*wxConvCurrent)); // skieu
    return buffer;
}

class WXDLLIMPEXP_WXLUA wxLuaCharBuffer
{
public:
    wxLuaCharBuffer(const wxString &wxstr) : m_buffer((const char *)NULL)
    {
        //wxCharBuffer charBuffer = wxConvertWX2MB(wxstr.c_str());
        // wxCharBuffer charBuffer = wxstr.mb_str(wxConvUTF8); // skieu
        wxCharBuffer charBuffer=wxConvUTF8.cWC2MB(wxstr.wc_str(*wxConvCurrent)); // skieu
        m_buffer = charBuffer;
    }

    size_t Length() const { return strlen((const char*)m_buffer); }
    const char *GetData() const { return (const char*)m_buffer; }

    wxCharBuffer m_buffer; // member since non virtual destructor in wxCharBuffer
};

Any comment on it? It fixes the problems for me and not create more problem in Linux. Have not tested with non unicode built of wxWidgets though. I still do not know why the problem happend in win32 only,


Cheers,



S.KIEU


____________________________________________________
On Yahoo!7
24: Watch it from 9.30pm on Thursdays on Seven
--- Begin Message --- Hi everyone,

I found a problem in win32 wrt unicode things. My test program is simple a multiline text widgets ; cut and paste a unicode text into the widgets and display the value using GetValue() by wx.wxMesasgeBox. In Linux it is working as expected. But in win2k, winXP , win98, it does not display anything pssibly the value is nil. If the text is not unicoded then it displayed correctly.

Wxwidgets in win32 compiled with unicode support and mslu support. Normal wx apps is fine.

wxLua is the snapshot  wxLua_Snapshot_2006-06-21.tar.gz

Is it a known problem and has been fixed in the current snapshot ? How to debug (if it is a bug then )

The following is the code smaple


f=wx.wxFrame(wx.wxNull, -1, "")
s0=wx.wxBoxSizer(wx.wxVERTICAL)
f:SetSizer(s0)
text=wx.wxTextCtrl(f, 10004,  "",  wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxTE_MULTILINE)
b0=wx.wxButton(f, 10000, "Display")
s0:AddWindow(text)
s0:AddWindow(b0)

f:Connect(-1, wx.wxEVT_COMMAND_BUTTON_CLICKED, function (e)

wx.wxMessageBox(text:GetValue())

end)

f:Show(true)

Cheers,



S.KIEU

Send instant messages to your online friends http://au.messenger.yahoo.com
--- End Message ---

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wxlua-users mailing list
Wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to