Pango-WARNING **: Invalid UTF-8 string passed to pango_layou

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
krisje8
Earned a small fee
Earned a small fee
Posts: 16
Joined: Sat Oct 28, 2006 1:24 pm
Location: The Netherlands
Contact:

Pango-WARNING **: Invalid UTF-8 string passed to pango_layou

Post by krisje8 »

I get the error in Konsole when I run my program, and I get a very large blank 'popup'.
I know it's in this piece of code somewhere:

Code: Select all

void IntraMsg2Frm::WxButton1Click(wxCommandEvent& event)
{
	// -+-+-+- SENDKNOP !!!! -+-+-+-

    char argument[1073];
    const char *aan = WxEdit1->GetValue().mb_str(wxConvUTF8); 	// Idem, maar nu voor aan.
    const char *bericht = Message->GetValue().mb_str(wxConvUTF8); //De inhoud van het berichtvakje                             		//is nu aan de char bericht gegeven.

    #if defined(__WINDOWS__)
       sprintf (argument,"NET SEND %s %s",aan,bericht);
       system(argument);
    #endif

    #if defined(__LINUX__)
       sprintf (argument,"echo \"%s\" | smbclient -M %s",bericht,aan);
       system(argument);

       wxString linmsg;
       linmsg.Printf(_T("even testen of ie linux wel herkent\n")
       		     _T("Dan hier ook maar ff het argument: \n %s")
		     _T("aan testen:\n %s")
		     _T("bericht testen:\n %s"), argument, aan, bericht );
		     wxMessageBox(linmsg,_T("Argument check op linux"), wxOK | wxICON_INFORMATION, this);
    #endif


}
What do I do wrong?

P.S.: My system is Sabayon (Gentoo) Linux .
"When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, *for free*'." - Linus Torvalds
User avatar
Ryan Norton
wxWorld Domination!
wxWorld Domination!
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton »

Maybe mb_str is the issue - in unicode builds it returns wxCharBuffer, and in ANSI the calls you make will do nothing (i.e. just the same as c_str). So, you should probably just be calling c_str instead and making sure the compilation is right; or, if you need utf8 youll need a roundtrip conversion in ANSI mode by calling wc_str with wxConvLocal and then converting it to utf8 via wxConvUTF8.cWC2MB.

Let me know if that helps :D.
[Mostly retired moderator, still check in to clean up some stuff]
krisje8
Earned a small fee
Earned a small fee
Posts: 16
Joined: Sat Oct 28, 2006 1:24 pm
Location: The Netherlands
Contact:

Post by krisje8 »

Ok, I changed it in this:

Code: Select all

const char *aan = WxEdit1->GetValue().wc_str(wxConvLocal); 	// Idem, maar nu voor aan.
    const char *bericht = Message->GetValue().wc_str(wxConvLocal); //De inhoud van het berichtvakje                             		//is nu aan de char bericht gegeven.
But now I get this error while compiling:

[quote]krisje8@localhost ~/IntraMsg2_1 $ g++ *.cpp `wx-config --libs --cxxflags` -o IntraMsg2
IntraMsg2Frm.cpp: In member function
"When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, *for free*'." - Linus Torvalds
Post Reply