>> PS.  I've tried to modify the source for MBCS conversion, and have
>> attached the diff file for what I have working for me.

Sorry, our mailing system might cut off the attached file.
I put it again.

--- from here --- from here --- from here --- from here 
diff -r -c ./MaxDB_ORG/sys/src/sp/hsp81.h ./MaxDB_DEV/sys/src/sp/hsp81.h
*** ./MaxDB_ORG/sys/src/sp/hsp81.h      Tue Oct 18 07:11:20 2005
--- ./MaxDB_DEV/sys/src/sp/hsp81.h      Fri Sep 22 08:25:53 2006
***************
*** 115,120 ****
--- 115,121 ----
  {
    tsp00_KnlIdentifierc  name;        /* Code page name */
    tsp00_Uint2           map[256];    /* UCS2 code points for all 256 ASCII 
Character of Code Page ID */
+   int isMultiByte;                   /* MultiByte codepage: 1, others: 0 */
  } tsp81_CodePage;
  
  /*!
diff -r -c ./MaxDB_ORG/sys/src/sp/vsp78_0.c ./MaxDB_DEV/sys/src/sp/vsp78_0.c
*** ./MaxDB_ORG/sys/src/sp/vsp78_0.c    Tue Oct 18 07:11:22 2005
--- ./MaxDB_DEV/sys/src/sp/vsp78_0.c    Fri Sep 22 08:33:53 2006
***************
*** 885,890 ****
--- 885,906 ----
        srcLimit = destBufferLengthInBytes;
        result = sp78_TargetExhausted;
      }
+ 
+ #ifdef WIN32
+     if( sp81CodePage && sp81CodePage->isMultiByte ) { // if MultiByte codepage
+         *destBytesWritten =
+             WideCharToMultiByte( CP_ACP, 0, srcBuffer, srcLimit,
+                                  (char *)destBuffer, destBufferLengthInBytes,
+                                  NULL, NULL );
+     if( srcLimit > 0 && *destBytesWritten <= 0 ) {
+         result = sp78_SourceCorrupted;
+     } else {
+         *srcBytesParsed = srcLengthInBytes;
+     }
+     return( result );
+   }
+ #endif
+ 
      *srcBytesParsed = sp81UCS2toASCII( (tsp00_Byte *)destBuffer,
                                          destBufferLengthInBytes,
                                          destBytesWritten,
diff -r -c ./MaxDB_ORG/sys/src/sp/vsp81.c ./MaxDB_DEV/sys/src/sp/vsp81.c
*** ./MaxDB_ORG/sys/src/sp/vsp81.c      Tue Oct 18 07:11:22 2005
--- ./MaxDB_DEV/sys/src/sp/vsp81.c      Fri Sep 22 08:30:50 2006
***************
*** 1505,1510 ****
--- 1505,1519 ----
          return sp81ASCIItoUCS2(dest, destLen, destSwapped, destOut, src, 
srcLen);
      }
  
+ #ifdef WIN32
+     if( srcCodePage && srcCodePage->isMultiByte ) { // if MultiByte codepage
+         convertCount = MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
+                                             src, srcLen, dest, destLen );
+         *destOut = convertCount;
+         return( convertCount );
+     }
+ #endif
+ 
      convertCount = ( srcLen > destLen ? destLen : srcLen );
  
      byteIndex = ( destSwapped ? 0 : 1 );
***************
*** 1567,1575 ****
--- 1576,1596 ----
  
  
/*---------------------------------------------------------------------------*/
  
+ static boolean sp81IsMultiByteCodePage(tsp81_CodePage *CodePage)
+ {
+     boolean isMultiByte = false;
+     if( CodePage && CodePage->name ) {
+         if( strcmp(CodePage->name, "WINDOWS-932") == 0 ) {
+             isMultiByte = true;
+         }
+     }
+     return( isMultiByte );
+ }
+ 
  tsp81_CodePage *sp81SetCodePage(tsp81_CodePage *CodePage)
  {
    tsp81_CodePage *oldCodePage = sp81CodePage;
+   CodePage->isMultiByte = sp81IsMultiByteCodePage( CodePage );
    sp81CodePage = CodePage;
    return oldCodePage;
  }
--- to here --- to here --- to here --- to here

--- ohtomo


-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to