You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2009/02/16 02:54:20 UTC

svn commit: r744789 - in /webservices/axis/trunk/c: build/ src/platforms/ src/platforms/os400/ src/soap/ src/soap/xsd/ src/transport/axis3/

Author: nadiramra
Date: Mon Feb 16 01:54:20 2009
New Revision: 744789

URL: http://svn.apache.org/viewvc?rev=744789&view=rev
Log:
AXISCPP-964 SOAP request/response not UTF-8 encoded (but claims to be)
AXISCPP-856 Add Platform Services Abstraction Layer

Added:
    webservices/axis/trunk/c/src/platforms/PlatformLanguage.cpp
    webservices/axis/trunk/c/src/platforms/PlatformLanguage.hpp
    webservices/axis/trunk/c/src/platforms/os400/PlatformLanguage.cpp
Removed:
    webservices/axis/trunk/c/src/platforms/PlatformLanguageUtils.cpp
    webservices/axis/trunk/c/src/platforms/PlatformLanguageUtils.hpp
    webservices/axis/trunk/c/src/platforms/os400/PlatformLanguageUtils.cpp
Modified:
    webservices/axis/trunk/c/build/buildClient.xml
    webservices/axis/trunk/c/build/buildTransport.xml
    webservices/axis/trunk/c/src/soap/apr_base64.cpp
    webservices/axis/trunk/c/src/soap/xsd/IAnySimpleType.cpp
    webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp

Modified: webservices/axis/trunk/c/build/buildClient.xml
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/build/buildClient.xml?rev=744789&r1=744788&r2=744789&view=diff
==============================================================================
--- webservices/axis/trunk/c/build/buildClient.xml (original)
+++ webservices/axis/trunk/c/build/buildClient.xml Mon Feb 16 01:54:20 2009
@@ -52,7 +52,7 @@
 						<include name="soap/xsd/constraints/*.cpp"/>
 						<include name="wsdd/*.cpp"/>
 						<include name="xml/*.cpp"/>
-	                    <include name="platforms/PlatformLanguageUtils.cpp" unless="os400"/>
+	                    <include name="platforms/PlatformLanguage.cpp" unless="os400"/>
 						<include name="platforms/windows/*.cpp" if="windows"/>
 						<include name="platforms/unix/*.cpp" if="linux"/>
 						<include name="platforms/unix/*.cpp" if="solaris"/>
@@ -82,7 +82,7 @@
 						<include name="soap/xsd/constraints/*.cpp"/>
 						<include name="wsdd/*.cpp"/>
 						<include name="xml/*.cpp"/>
-					    <include name="platforms/PlatformLanguageUtils.cpp"/>
+					    <include name="platforms/PlatformLanguage.cpp"/>
 						<include name="platforms/unix/*.cpp"/>
 					</fileset>
 				</cc>

Modified: webservices/axis/trunk/c/build/buildTransport.xml
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/build/buildTransport.xml?rev=744789&r1=744788&r2=744789&view=diff
==============================================================================
--- webservices/axis/trunk/c/build/buildTransport.xml (original)
+++ webservices/axis/trunk/c/build/buildTransport.xml Mon Feb 16 01:54:20 2009
@@ -46,7 +46,7 @@
                         <include name="soap/apr_base64.cpp" />
                         <include name="transport/${transport}/*.cpp" />
                         <include name="common/AxisTrace.cpp"/>
-                    	<include name="platforms/os400/PlatformLanguageUtils.cpp" if="os400"/>
+                    	<include name="platforms/os400/PlatformLanguage.cpp" if="os400"/>
                         <include name="platforms/os400/PlatformSpecificOS400.cpp" if="os400" />
                         <include name="platforms/windows/PlatformSpecificWindows.cpp" if="windows" />
                     </fileset>

Added: webservices/axis/trunk/c/src/platforms/PlatformLanguage.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/platforms/PlatformLanguage.cpp?rev=744789&view=auto
==============================================================================
--- webservices/axis/trunk/c/src/platforms/PlatformLanguage.cpp (added)
+++ webservices/axis/trunk/c/src/platforms/PlatformLanguage.cpp Mon Feb 16 01:54:20 2009
@@ -0,0 +1,143 @@
+/* -*- C++ -*- */
+/*
+ *   Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ *
+ */
+
+// !!! This include file must be first thing in file !!!
+#include "PlatformAutoSense.hpp"
+
+#include "PlatformLanguage.hpp"
+
+#include "../engine/AxisEngineException.h"
+#include "../common/AxisTrace.h"
+
+
+AXIS_CPP_NAMESPACE_START
+
+//******************************************************************************
+//
+// PlatformLanguage::initialize() Implementation
+//
+//******************************************************************************
+void PlatformLanguage::
+initialize()
+{
+
+}
+
+//******************************************************************************
+//
+// PlatformLanguage::uninitialize() Implementation
+//
+//******************************************************************************
+void PlatformLanguage::
+uninitialize()
+{
+
+}
+
+//******************************************************************************
+//
+// PlatformLanguage::toWchar() Implementation
+//
+//******************************************************************************
+wchar_t * PlatformLanguage::
+toWchar(const char *charBuf, int charLen)
+{
+    logSetFunctionNameEngine("PlatformLanguage::toWchar")
+    
+    if (charBuf == NULL || charLen == 0)
+        return NULL;
+    
+    // Allocate buffer.  Need to make sure buffer will fit wide-character
+    // representation of character string, including null-terminating character.
+    wchar_t *outBuffer = new wchar_t[charLen];
+    
+    // Now call wide-character function to convert string to wide-character.
+    size_t nbrGenerated = mbstowcs(outBuffer, charBuf, charLen);
+    
+    if (nbrGenerated == (size_t)-1)
+    {
+        delete [] outBuffer;
+        
+        logThrowExceptionNoExit("AxisEngineException: Error converting from character to wide-character.")
+        
+        throw AxisEngineException(-999, "Error converting from character to wide-character.");
+    }
+    
+    return outBuffer;
+}
+
+//******************************************************************************
+//
+// PlatformLanguage::toChar() Implementation
+//
+//******************************************************************************
+char * PlatformLanguage:: 
+toChar(const wchar_t *wcharBuf, int wcharLen)
+{
+    logSetFunctionNameEngine("PlatformLanguage::toChar")
+    
+    if (wcharBuf == NULL || wcharLen == 0)
+        return NULL;
+    
+    // Allocate buffer.  Need to make sure buffer will fit character
+    // representation of wide-character string, including null-terminating character.
+    int bufLen = (wcharLen * MB_CUR_MAX);
+    char *outBuffer = new char[bufLen];
+    
+    // Now call wide-character function to convert wide-character to character string.
+    size_t nbrGenerated = wcstombs(outBuffer, wcharBuf, bufLen);
+    
+    if (nbrGenerated == (size_t)-1)
+    {
+        delete [] outBuffer;
+        
+        logThrowExceptionNoExit("AxisEngineException: Error converting from wide-character to character.")
+
+        throw AxisEngineException(-999, "Error converting from wide-character to character.");
+    }
+    
+    return outBuffer;
+}
+
+//******************************************************************************
+//
+// PlatformLanguage::toUTF8() Implementation
+//
+//******************************************************************************
+char * PlatformLanguage:: 
+toUTF8(const char *charBuf, int charLen)
+{
+    logSetFunctionNameEngine("PlatformLanguage::toUTF8")
+    
+    if (charBuf == NULL || charLen == 0)
+        return NULL;
+    
+    // TODO
+    // I do not think there is a generic way to do this 
+    // that is acceptable by windows and unix platforms (maybe iconv?), so if someone
+    // wants to do this then they have to create plarform-specific copy of this file and
+    // put in proper directory and update the build/buildClient.xml file to pick the 
+    // platform file instead of the common file. See how os400 does it. 
+    logThrowExceptionNoExit("AxisEngineException: Error converting to UTF-8.")
+
+    throw AxisEngineException(-999, "Error converting to utf-8.");
+}
+
+AXIS_CPP_NAMESPACE_END

Added: webservices/axis/trunk/c/src/platforms/PlatformLanguage.hpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/platforms/PlatformLanguage.hpp?rev=744789&view=auto
==============================================================================
--- webservices/axis/trunk/c/src/platforms/PlatformLanguage.hpp (added)
+++ webservices/axis/trunk/c/src/platforms/PlatformLanguage.hpp Mon Feb 16 01:54:20 2009
@@ -0,0 +1,84 @@
+/* -*- C++ -*- */
+/*
+ *   Copyright 2003-2004 The Apache Software Foundation.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+#if !defined(AXIS_PLATFORMLANGUAGE_H__OF_AXIS_INCLUDED_)
+#define AXIS_PLATFORMLANGUAGE_H__OF_AXIS_INCLUDED_
+
+#include <axis/GDefine.hpp>
+#include <string>
+#include <wchar.h>
+
+using namespace std;
+
+
+AXIS_CPP_NAMESPACE_START
+
+/**
+ * Contains methods in support of national languages. 
+ */
+class STORAGE_CLASS_INFO PlatformLanguage
+{
+  public:
+	/**
+	  * Must be called once to initialize/allocate any internal objects that are needed. 
+	  * Can be called multiple times - subsequent calls are no-ops. 
+	  */ 
+	static void initialize();
+	
+	/**
+	  * Reclaims any allocated objects. Can be called multiple times.
+	  */ 
+	static void uninitialize();
+	  
+    /**
+     * Returns dynamially allocated buffer containing the wide character representation 
+     * of the passed-in character string.  Caller owns the memory returned. 
+     * 
+     * @param pointer to character string buffer.
+     * @param number of characters in string, including null-terminator. 
+     * 
+     * @return pointer to null-terminated wide-character string.
+     */
+    static wchar_t * toWchar(const char *charBuf, int charLen);
+    
+    /**
+     * Returns dynamially allocated buffer containing the character representation 
+     * of the passed-in wide-character string.  Caller owns the memory returned. 
+     * 
+     * @param pointer to null-terminated wide-character buffer string.
+     * @param number of characters in wide-character string, including null-terminator.
+     * 
+     * @return pointer to null-terminated character string.
+     */
+    static char *    toChar(const wchar_t *wcharBuf, int wcharLen);
+    
+    /**
+     * Returns dynamically allocated buffer containing UTF-8 representation
+     * of passed-in character data. Caller owns the memory returned.
+     * 
+     * @param pointer to null-terminated character string.
+     * @param length of character string, including null-terminator.
+     * 
+     * @return pointer to null-terminated UTF-8 character string.
+     */
+    static char *    toUTF8(const char *charBuf, int charLen);
+};
+
+AXIS_CPP_NAMESPACE_END
+
+#endif 

Added: webservices/axis/trunk/c/src/platforms/os400/PlatformLanguage.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/platforms/os400/PlatformLanguage.cpp?rev=744789&view=auto
==============================================================================
--- webservices/axis/trunk/c/src/platforms/os400/PlatformLanguage.cpp (added)
+++ webservices/axis/trunk/c/src/platforms/os400/PlatformLanguage.cpp Mon Feb 16 01:54:20 2009
@@ -0,0 +1,215 @@
+/* -*- C++ -*- */
+/*
+ *   Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ *
+ */
+
+// !!! This include file must be first thing in file !!!
+#include "../PlatformAutoSense.hpp"
+
+#include <limits.h>                     // MB_LEN_MAX
+#include <iconv.h>                      // iconv_t, iconv()
+#include <qtqiconv.h>                   // QtqCode_T, QtqIconvOpen()
+#include <errno.h>
+
+#include "../PlatformLanguage.hpp"
+
+#include "../../engine/AxisEngineException.h"
+#include "../../common/AxisTrace.h"
+
+// code pages for job, utf-8, and ucs2 
+#define CCSID_JOB 0
+#define CCSID_UTF8 1208
+#define CCSID_UCS2 13488
+
+AXIS_CPP_NAMESPACE_START
+
+// Following helper function is defined at the bottom.
+static iconv_t generateConverter(int fromCcsid, int toCcsid);
+
+//******************************************************************************
+//
+// PlatformLanguage::initialize() Implementation
+//
+//******************************************************************************
+void PlatformLanguage::
+initialize()
+{
+
+}
+
+//******************************************************************************
+//
+// PlatformLanguage::uninitialize() Implementation
+//
+//******************************************************************************
+void PlatformLanguage::
+uninitialize()
+{
+
+}
+
+//******************************************************************************
+//
+// PlatformLanguage::toWchar() Implementation
+//
+// Notes: 
+//   - Wide character is implemented as UCS-2 when compiled with LOCALETYPE(*LOCALEUCS2).
+//     Because the C runtime wide-character routines depend on locale, and
+//     locale is not normally set, we need to do the conversions using iconv.
+//
+//******************************************************************************
+static iconv_t cvtrJobToUCS2 = generateConverter(CCSID_JOB, CCSID_UCS2);
+
+wchar_t * PlatformLanguage::
+toWchar(const char *charBuf, int charLen)
+{
+    logSetFunctionNameEngine("PlatformLanguage::toWchar")
+
+    if (charLen == 0 || charBuf == NULL)
+        return NULL;
+
+    size_t outBytesLeft = charLen*sizeof(wchar_t);
+    wchar_t *outBuffer = (wchar_t *) new wchar_t[charLen];
+
+    int myToBufLen = outBytesLeft;
+    char *myToBuf = (char *)outBuffer;
+
+    size_t irc = iconv(cvtrJobToUCS2, (char **)&charBuf, (size_t *)&charLen, &myToBuf, &outBytesLeft);
+    myToBufLen -= outBytesLeft;
+
+    if (irc == (size_t)-1)
+    {
+        delete [] outBuffer;
+        
+        logThrowExceptionNoExit("AxisEngineException: Error converting from character to wide-character.")
+        
+        throw AxisEngineException(-999, "Error converting from character to wide-character.");
+    }
+
+    return outBuffer;
+}
+
+//******************************************************************************
+//
+// PlatformLanguage::toChar() Implementation
+//
+// Notes: 
+//   - Wide character is implemented as UCS-2 when compiled with LOCALETYPE(*LOCALEUCS2).
+//     Because the C runtime wide-character routines depend on locale, and
+//     locale is not normally set, we need to do the conversions using iconv.
+//
+//******************************************************************************
+static iconv_t cvtrUCS2ToJob = generateConverter(CCSID_UCS2, CCSID_JOB);
+char * PlatformLanguage:: 
+toChar(const wchar_t *wcharBuf, int wcharLen)
+{
+    logSetFunctionNameEngine("PlatformLanguage::toChar")
+
+    if (wcharLen == 0 || wcharBuf == NULL)
+        return NULL;
+
+    size_t outBytesLeft = (wcharLen * MB_LEN_MAX);
+    char *outBuffer = (char *) new char[wcharLen * MB_LEN_MAX];
+
+    int myToBufLen = outBytesLeft;
+    char *myToBuf = outBuffer;
+
+    int numberOfBytes = wcharLen * sizeof(wchar_t);
+    size_t irc = iconv(cvtrUCS2ToJob, (char **)&wcharBuf, (size_t *)&numberOfBytes, &myToBuf, &outBytesLeft);
+    myToBufLen -= outBytesLeft;
+
+    if (irc == (size_t)-1)
+    {
+        delete [] outBuffer;
+        
+        logThrowExceptionNoExit("AxisEngineException: Error converting from wide-character to character.")
+
+        throw AxisEngineException(-999, "Error converting from wide-character to character.");
+    }
+
+    return outBuffer;
+}
+
+//******************************************************************************
+//
+// PlatformLanguage::toUTF8() Implementation
+//
+//******************************************************************************
+static iconv_t cvtrJobToUtf8 = generateConverter(CCSID_JOB, CCSID_UTF8);
+
+char * PlatformLanguage::
+toUTF8(const char *charBuf, int charLen)
+{
+   logSetFunctionNameEngine("PlatformLanguage::toUTF8")
+
+   if (charLen == 0 || charBuf == NULL)
+      return strdup("");
+
+   size_t outBytesLeft = 4*charLen;
+   char *outBuffer = (char *) new char[outBytesLeft];
+
+   int myToBufLen = outBytesLeft;
+   char *myToBuf = outBuffer;
+
+   size_t irc = iconv(cvtrJobToUtf8, (char **)&charBuf, (size_t *)&charLen,&myToBuf, &outBytesLeft);
+   myToBufLen -= outBytesLeft;
+        
+   if (irc == (size_t)-1)
+   {
+       delete [] outBuffer;
+       
+       logThrowExceptionNoExit("AxisEngineException: Error converting to UTF-8.")
+
+       throw AxisEngineException(-999, "Error converting to utf-8.");   
+   }
+
+   return outBuffer;
+}
+
+// +++++++++++++++++++++++++++++++++++++++++
+// FOLLOWING ARE UTILITY ROUTINES
+// +++++++++++++++++++++++++++++++++++++++++
+
+//==============================================================================
+//
+// generateConverter() Implementation
+//
+//==============================================================================
+
+iconv_t generateConverter
+(
+ int fromCcsid,
+ int toCcsid
+ )
+{
+    iconv_t converterObject;
+    
+    QtqCode_T toCode, fromCode;
+    
+    memset(&toCode, 0x00, sizeof(QtqCode_T));
+    memset(&fromCode, 0x00, sizeof(QtqCode_T));
+
+    fromCode.CCSID = fromCcsid;
+    fromCode.shift_alternative = 1;
+    toCode.CCSID = toCcsid;
+    converterObject = QtqIconvOpen(&toCode, &fromCode);
+
+    return converterObject;
+}
+
+AXIS_CPP_NAMESPACE_END

Modified: webservices/axis/trunk/c/src/soap/apr_base64.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/apr_base64.cpp?rev=744789&r1=744788&r2=744789&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/soap/apr_base64.cpp (original)
+++ webservices/axis/trunk/c/src/soap/apr_base64.cpp Mon Feb 16 01:54:20 2009
@@ -18,7 +18,7 @@
 #include "../platforms/PlatformAutoSense.hpp"
 
 #include "apr_base64.h"
-#include "../platforms/PlatformLanguageUtils.hpp"
+#include "../platforms/PlatformLanguage.hpp"
 
 #include "../common/AxisTrace.h"
 
@@ -158,7 +158,7 @@
     return apr_base64_encode_binary(encoded, (const unsigned char *) string, strlen(string));
 #else /* __OS400__ */
     // First convert to UTF-8, then encode data using apr_base64_encode_binary
-    char *utf8Buffer = (char *)axiscpp::PlatformLanguageUtils::toUTF8((const char *)string, strlen(string)+1);
+    char *utf8Buffer = (char *)axiscpp::PlatformLanguage::toUTF8((const char *)string, strlen(string)+1);
     int rc = apr_base64_encode_binary(encoded, (const unsigned char *)utf8Buffer, strlen(utf8Buffer));
     delete utf8Buffer;
     return rc;

Modified: webservices/axis/trunk/c/src/soap/xsd/IAnySimpleType.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/xsd/IAnySimpleType.cpp?rev=744789&r1=744788&r2=744789&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/IAnySimpleType.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/IAnySimpleType.cpp Mon Feb 16 01:54:20 2009
@@ -18,7 +18,7 @@
 
 #include "IAnySimpleType.hpp"
 
-#include "../../platforms/PlatformLanguageUtils.hpp"       
+#include "../../platforms/PlatformLanguage.hpp"       
 
 const wchar_t XML_ENTITY_REFERENCE_CHARS_WS[] = L"<>&\"\'";
 
@@ -123,7 +123,7 @@
     // Must do character replacement as wide-character since for locales in which a character
     // represents multiple bytes we might inadverently replace a character that really 
     // is not a reserved character.  This is especially true for EBCDIC-based systems. 
-    wchar_t *wcs = PlatformLanguageUtils::toWchar(inValue.c_str(), inValue.length()+1);
+    wchar_t *wcs = PlatformLanguage::toWchar(inValue.c_str(), inValue.length()+1);
     wstring inValueW = wcs;
     delete [] wcs;
     
@@ -182,7 +182,7 @@
         outValueW += inValueW.substr (nOldIdx, nLen); 
     
     // Now convert data back to character string and return.
-    char *temps = PlatformLanguageUtils::toChar((const wchar_t *)outValueW.c_str(), outValueW.length()+1);
+    char *temps = PlatformLanguage::toChar((const wchar_t *)outValueW.c_str(), outValueW.length()+1);
     outValue = temps;
     delete [] temps;
     

Modified: webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp?rev=744789&r1=744788&r2=744789&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp (original)
+++ webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp Mon Feb 16 01:54:20 2009
@@ -25,7 +25,7 @@
 
 #include "HTTPTransport.hpp"
 
-#include "../../platforms/PlatformLanguageUtils.hpp"
+#include "../../platforms/PlatformLanguage.hpp"
 
 // for the basic auth encryption
 #include "../../soap/apr_base64.h"
@@ -309,11 +309,11 @@
         m_pActiveChannel->writeBytes(m_strBytesToSend.c_str(), m_strBytesToSend.length());
 #else
         // Ebcdic (OS/400) systems need to convert the data to UTF-8. 
-        utf8Buf = PlatformLanguageUtils::toUTF8((const char *)m_strHeaderBytesToSend.c_str(), m_strHeaderBytesToSend.length()+1);
+        utf8Buf = PlatformLanguage::toUTF8((const char *)m_strHeaderBytesToSend.c_str(), m_strHeaderBytesToSend.length()+1);
         m_pActiveChannel->writeBytes(utf8Buf, strlen(utf8Buf));
         delete utf8Buf;
         utf8Buf = NULL;
-        utf8Buf = PlatformLanguageUtils::toUTF8((const char *)m_strBytesToSend.c_str(), m_strBytesToSend.length()+1);
+        utf8Buf = PlatformLanguage::toUTF8((const char *)m_strBytesToSend.c_str(), m_strBytesToSend.length()+1);
         m_pActiveChannel->writeBytes(utf8Buf, strlen(utf8Buf));
         delete utf8Buf;
         utf8Buf = NULL;