Hi,
marcos yazmış:
> Thanks John,
> You are right!
>
> The problem with string comparison in the new version persists.
>
>
> Please test this code on your machine:
>
> --------------------------
> wx.wxLocale( wx.wxLANGUAGE_DEFAULT )
> local loc= wx.wxGetLocale()
> local s = 'Maçã'
> print(loc:GetString(s), s)
> print('loc:GetString(s)==s ->', loc:GetString(s)==s) -- first
> print( "s=='Maçã' ", s=='Maçã' ) -- second
>
> ---------------
> On previous version of wxLua the first comparison return true.
> But in the new version return false.
>
> I suspect wxLua convert the lua_string to another charset(UTF-8) and
> then it fail.
>
Yes, wxLua assumes utf8 in unicode build. Do you have a chance to
re-compile wxLua for testing? I'm modifying lua2wx and wx2lua as follows
(for unicode build and Turkish locale):
----- file: modules/wxlua/include/wxlstate.h ------------
// Convert a 8-bit ANSI C Lua String into a wxString
inline /*WXDLLIMPEXP_WXLUA*/ wxString lua2wx(const char* luastr)
{
if (luastr == NULL) return wxEmptyString; // check for NULL
#ifdef __WXGTK__
#if wxUSE_UNICODE
wxString str(luastr, wxConvUTF8);
#else
wxString str(wxConvUTF8.cMB2WC(luastr), *wxConvCurrent);
#endif // wxUSE_UNICODE
#else
wxString str(luastr, *wxConvCurrent);
#endif
if (str.IsEmpty())
str = wxConvertMB2WX(luastr); // old way that mostly works
return str;
}
// Convert a wxString to 8-bit ANSI C Lua String
inline const /*WXDLLIMPEXP_WXLUA*/ wxCharBuffer wx2lua(const wxString&
wxstr)
{
#ifdef __WXGTK__
wxCharBuffer
buffer(wxConvUTF8.cWC2MB(wxstr.wc_str(*wxConvCurrent))); // skieu
#else
wxCharBuffer buffer(wxstr.mb_str(*wxConvCurrent));
#endif
if ((buffer.data() == NULL) && !wxstr.IsEmpty())
buffer = wxConvertWX2MB(wxstr.c_str()); // old way that mostly
works
return buffer;
}
---------------------------------------------------------
> I edit my code with Scite. Running this file with wxLua the comparison
> is false.
> When I open the file in wxLua(editor) and run the comparison is true.
> When I open the file in wxLua(editor) and save it and reopen with Scite
> the charset has changed to UTF-8 and running it the comparison is true.
>
> This is a big trouble to me.
>
>
> Thanks
>
>
> --
> Marcos E. Wurzius
>
>
--
Regards,
Hakki Dogusan
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
wxlua-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxlua-users