On 12/6/06, John Labenski <[EMAIL PROTECTED]> wrote:
> On 12/6/06, Hakki Dogusan <[EMAIL PROTECTED]> wrote:
> > John Labenski wrote:
> > > On 12/5/06, Hakki Dogusan <[EMAIL PROTECTED]> wrote:
> > >> (Mingw, wxLua cvs, wx2.7.2/wx2.8 ANSI and Unicode, WinXP Turkish)
> > >>
> > >> I can't use Turkish chars (ie. ğüşiöçı ĞÜŞİÖÇİ) in label, title, etc.
> > >>
> > >> If I change the following functions to old implementation, it works:
> > >> lua2wx, wx2lua.
> > >
> > > Please see this message
> > > Re: [Wxlua-users] wxString, Unicode problem .... (Fixed,) Steve Kieu
> > > http://www.mail-archive.com/wxlua-users@lists.sourceforge.net/index.html#00692
> > >
> > > // Convert a 8-bit Lua String into wxString
> > > inline WXDLLIMPEXP_WXLUA wxString lua2wx(const char* luastr)
> > > {
> > >     if (luastr == NULL) return wxEmptyString; // check for NULL
> > >
> > > #if wxUSE_UNICODE
> > >     return wxString(luastr, wxConvUTF8);
> > > #else
> > >     return wxString(wxConvUTF8.cMB2WC(luastr), *wxConvCurrent);
> > > #endif // wxUSE_UNICODE
> > >
> > >   //return wxConvertMB2WX(luastr); // old way that mostly works
> > > }
> > >
> > > // Convert a wxString to 8-bit Lua String
> > > inline const WXDLLIMPEXP_WXLUA wxCharBuffer wx2lua(const wxString& wxstr)
> > > {
> > >     //wxCharBuffer buffer(wxConvertWX2MB(wxstr.c_str())); // old way
> > > that mostly works
> > >     wxCharBuffer
> > > buffer(wxConvUTF8.cWC2MB(wxstr.wc_str(*wxConvCurrent))); // skieu
> > >     return buffer;
> > > }
> > >
> > > ====================================
> > >
> >
> > If I'm not mistaken stc uses UTC2 internally. So using stc's conversion
> > functions may not help here. Instead, I tested using FlameRobin's
> > (www.flamerobin.org) functions from StringUtils.h;
> > std::string wx2std(const wxString& input, wxMBConv* conv=wxConvCurrent);
> > wxString std2wx(const std::string& input, wxMBConv* conv=wxConvCurrent);
>
> Humm, interesting... see below.
>
> > Changed lua2wx, wx2lua and wxLuaCharBuffer's ctor as follows:
> >
> > inline WXDLLIMPEXP_WXLUA wxString lua2wx(const char* luastr)
> > {
> >      if (luastr == NULL) return wxEmptyString; // check for NULL
> >      return wxString(luastr, *wxConvCurrent);
> > }
>
> The old way of doing the conversion did it this way.
>
> //return wxConvertMB2WX(luastr); // old way that mostly works
> #define wxConvertMB2WX(s)   wxConvCurrent->cMB2WX(s)
>
> This is the code for the wxString function which does the same as 
> wxConvertMB2WX
> wxString::wxString(const char *psz, const wxMBConv& conv, size_t nLength)
> {
> ...
>       wxWCharBuffer wbuf = conv.cMB2WC(psz, nLength, &nLenWide);
>
> ==================
> I see that we have 3 different ways to convert the strings. Which way
> is "right" for all cases.
>
> 1) doesn't work for some unknown cases
>     wxConvertMB2WX == wxConvCurrent->cMB2WX(s) ==
> wxConvCurrent->cMB2WC
>
> 2) Doesn't work for Turkish (and undoubtedly others)
> #if wxUSE_UNICODE
>     return wxString(luastr, wxConvUTF8);
> #else
>     return wxString(wxConvUTF8.cMB2WC(luastr), *wxConvCurrent);
> #endif // wxUSE_UNICODE
>
> 3) new? works?
>     wxString(luastr, *wxConvCurrent); ==
>     wxWCharBuffer wbuf = conv.cMB2WC(psz, nLength, &nLenWide);
>
>
> The differences I see is that

Oops, message got sent when I pressed some keys by accident.

So #1 == #3 and #2 uses wxConvUTF8 instead of wxConvCurrent.

I know that wxUSE_UNICODE uses wchar_t
wxConvCurrent ==  &wxConvLibcObj ==
    #ifdef __WINDOWS__
        static wxMBConv_win32 wxConvLibcObj;
    #elif defined(__WXMAC__) && !defined(__MACH__)
        static wxMBConv_mac wxConvLibcObj ;
    #else
        static wxMBConvLibc wxConvLibcObj;
    #endif

I think we need to have answers to these questions.

How do you know if you're using UTF8?
How do you set wxWidgets to use or not use UTF8 if you want to?
If you get text from the clipboard, can it be in UTF8?

and finally, is wxConvCurrent supposed to handle UTF8 as is?

I personally don't have any idea and would naively think that
wxConvCurrent instead of wxConvUTF8 is the right thing to do.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to