SF.net SVN: mahogany: [7193] trunk/M/src/gui/wxMGuiUtils.cpp

[email protected]
Newsgroups gmane.mail.mahogany.cvs
Message-ID <[email protected]>
Revision: 7193
          http://svn.sourceforge.net/mahogany/?rev=7193&view=rev
Author:   vadz
Date:     2006-12-25 12:00:19 -0800 (Mon, 25 Dec 2006)

Log Message:
-----------
fixed bug which resulted in strings in charsets not supported by the system being replaced with empty strings (even though if we could convert them properly using wxWidgets built in conversion code)

Modified Paths:
--------------
    trunk/M/src/gui/wxMGuiUtils.cpp

Modified: trunk/M/src/gui/wxMGuiUtils.cpp
===================================================================
--- trunk/M/src/gui/wxMGuiUtils.cpp	2006-12-25 19:35:03 UTC (rev 7192)
+++ trunk/M/src/gui/wxMGuiUtils.cpp	2006-12-25 20:00:19 UTC (rev 7193)
@@ -52,19 +52,24 @@
             wxWCharBuffer wbuf(a2w.cMB2WC(text->c_str()));
             if ( *wbuf )
             {
+               wxString textConv;
+
                // special case of UTF-8 which is used all the time under wxGTK
                if ( encAlt == wxFONTENCODING_UTF8 )
                {
-                  *text = wxConvUTF8.cWC2MB(wbuf);
+                  textConv = wxConvUTF8.cWC2MB(wbuf);
                }
                else // all the other encodings, use generic converter
                {
                   wxCSConv w2a(encAlt);
-                  *text = w2a.cWC2MB(wbuf);
+                  textConv = w2a.cWC2MB(wbuf);
                }
 
-               if ( !text->empty() )
+               if ( !textConv.empty() )
+               {
+                  *text = textConv;
                   return true;
+               }
                //else: fall back to wxEncodingConverter
             }
             //else: conversion to Unicode failed


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.