Update of /cvsroot/mahogany/M/src/gui
In directory usw-pr-cvs1:/tmp/cvs-serv13094/src/gui
Modified Files:
wxFolderView.cpp wxMessageView.cpp wxlparser.cpp
Log Message:
finished UTF-7 support
Index: wxFolderView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderView.cpp,v
retrieving revision 1.579
retrieving revision 1.580
diff -b -u -2 -r1.579 -r1.580
--- wxFolderView.cpp 16 Apr 2002 02:45:52 -0000 1.579
+++ wxFolderView.cpp 16 Apr 2002 16:03:15 -0000 1.580
@@ -2849,9 +2849,9 @@
wxFontEncoding encoding = hi->GetEncoding();
- // optionally convert from UTF-8 to environment's default encoding
+ // optionally convert from UTF-8|7 to environment's default encoding
// FIXME it won't be needed when full Unicode support is available
- if ( encoding == wxFONTENCODING_UTF8 )
+ if ( encoding == wxFONTENCODING_UTF8 || encoding == wxFONTENCODING_UTF7 )
{
- encoding = ConvertUnicodeToSystem(&text);
+ encoding = ConvertUnicodeToSystem(&text, encoding == wxFONTENCODING_UTF7);
}
@@ -2939,8 +2939,8 @@
wxFontEncoding enc = hi->GetEncoding();
- if ( enc == wxFONTENCODING_UTF7 || enc == wxFONTENCODING_UTF8 )
+ if ( enc == wxFONTENCODING_UTF8 || enc == wxFONTENCODING_UTF7 )
{
// As we converted text to environment's default encoding above, encoding
- // is no longer wxFONTENCODING_UTF7|8, but wxLocale::GetSystemEncoding().
+ // is no longer wxFONTENCODING_UTF8|7, but wxLocale::GetSystemEncoding().
enc = wxLocale::GetSystemEncoding();
}
Index: wxMessageView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMessageView.cpp,v
retrieving revision 1.276
retrieving revision 1.277
diff -b -u -2 -r1.276 -r1.277
--- wxMessageView.cpp 16 Apr 2002 13:44:28 -0000 1.276
+++ wxMessageView.cpp 16 Apr 2002 16:03:16 -0000 1.277
@@ -72,4 +72,10 @@
#include <wx/splitter.h>
+#include "Mcclient.h"
+extern "C"
+{
+ #include "utf8.h" // for utf8_text_utf7()
+}
+
// ----------------------------------------------------------------------------
// options we use here
@@ -552,5 +558,5 @@
}
-// convert a string in UTF-8 into the string in the current encoding: of
+// convert a string in UTF-8 or 7 into the string in the current encoding: of
// course, this doesn't work in general as Unicode is not representable as an 8
// bit charset but it works in some common cases and is better than no UTF-8
@@ -558,5 +564,5 @@
//
// FIXME this won't be needed when full Unicode support is available
-extern wxFontEncoding ConvertUnicodeToSystem(wxString *strUtf)
+extern wxFontEncoding ConvertUnicodeToSystem(wxString *strUtf, bool isUTF7)
{
CHECK( strUtf, wxFONTENCODING_SYSTEM,
@@ -565,4 +571,32 @@
if ( !strUtf->empty() )
{
+ if ( isUTF7 )
+ {
+ //wxWindows does not support UTF-7 yet, so we first convert
+ //UTF-7 to UTF-8 using c-client function and then convert
+ //UTF-8 to current environment's encoding.
+
+ SIZEDTEXT *text7 = new SIZEDTEXT;
+ SIZEDTEXT *text8 = new SIZEDTEXT;
+ text7->data = (unsigned char *) strUtf->c_str();
+ text7->size = strUtf->Length();
+
+ // cclient doesn't use the table parameter in utf8_text_utf7
+ // function but still has it (for future extensions? or just
+ // because other conversion functions have it?)
+ void *tab = NULL;
+ utf8_text_utf7 ( text7, text8, tab );
+ strUtf->Empty();
+
+ // we cannot use "*strUtf << text8->data" here as utf8_text_utf7()
+ // returns text8->data which is longer than text8->size:
+ for ( unsigned long k = 0; k < text8->size; k++ )
+ {
+ *strUtf << wxChar(text8->data[k]);
+ }
+ free(text7);
+ free(text8);
+ }
+
wxString str(strUtf->wc_str(wxConvUTF8), wxConvLocal);
if ( str.empty() )
Index: wxlparser.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxlparser.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -b -u -2 -r1.49 -r1.50
--- wxlparser.cpp 16 Apr 2002 02:50:38 -0000 1.49
+++ wxlparser.cpp 16 Apr 2002 16:03:17 -0000 1.50
@@ -187,8 +187,8 @@
wxString str = strOrig;
- if ( encoding == wxFONTENCODING_UTF8 )
+ if ( encoding == wxFONTENCODING_UTF8 || encoding == wxFONTENCODING_UTF7 )
{
- // Convert from UTF-8 to environment's default encoding
- encoding = ConvertUnicodeToSystem(&str);
+ // Convert from UTF-8|7 to environment's default encoding
+ encoding = ConvertUnicodeToSystem(&str, encoding == wxFONTENCODING_UTF7);
}
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates