[3550]
Re: UTF-8文字化け
じゅうじ
>>data[3252]2003/10 Re: UTF-8文字化け
WAVE DASH の問題で、U301C と UFF5E を交換するパッチです。
Google の検索をしたHTMLソースで、
「~」記号が使用出来るようになります。
--- original ~ CMemory.h Wed Jan 01 10:58:18 2003
+++ CMemory.h Sun Apr 25 20:13:36 2004
@@ -191,3 +191,4 @@
static unsigned short _mbcjmstojis_ex( unsigned char* pszSrc );
-
+private:
+ static void ExchangeWaveDash( unsigned char* ); /* WAVE DASH を、~と交換。 2004/04/23 じゅうじ */
};
--- original ~ CMemory.cpp Tue Apr 13 20:53:16 2004
+++ CMemory.cpp Sun Apr 25 20:07:00 2004
@@ -1263,2 +1263,3 @@
if( 2 == nUNICODEBytes ){
+ ExchangeWaveDash( (unsigned char *)pWork ); /* 2004/04/23 じゅうじ */
j = wctomb( (char*)&(pDes[k]), ((wchar_t*)pWork)[0] );
@@ -1290,5 +1291,10 @@
-
-
-
+/* WAVE DASH を、~と交換。 2004/04/23 じゅうじ */
+void CMemory::ExchangeWaveDash( unsigned char *pWork )
+{
+ if(pWork[1] == 0xFF && pWork[0] == 0x5E)
+ pWork[1] = 0x30, pWork[0] = 0x1C;
+ else if(pWork[1] == 0x30 && pWork[0] == 0x1C)
+ pWork[1] = 0xFF, pWork[0] = 0x5E;
+}
@@ -2023,2 +2029,3 @@
j = mbtowc( &wchar, &pBuf[i], nCharChars );
+ ExchangeWaveDash( (unsigned char *)&wchar ); /* 2004/04/23 じゅうじ */
if( j == -1 || j == 0 ){
@@ -2060,2 +2067,3 @@
for( i = 0; i < nBufLen / (int)sizeof( wchar_t ); ++i ){
+ ExchangeWaveDash( (unsigned char *)&pUniBuf[i] ); /* 2004/04/23 じゅうじ */
j = wctomb( (char*)mbchar, pUniBuf[i] );
@@ -2071,2 +2079,3 @@
for( i = 0; i < nBufLen / (int)sizeof( wchar_t ); ++i ){
+ ExchangeWaveDash( (unsigned char *)&pUniBuf[i] ); /* 2004/04/23 じゅうじ */
j = wctomb( (char*)&(pBufSJIS[k]), pUniBuf[i] );
@@ -2793,2 +2802,3 @@
j = mbtowc( &wchar, (const char*)&pBuf[i], nCharChars );
+// ExchangeWaveDash( (unsigned char *)&wchar ); /* 2004/04/23 じゅうじ */
@@ -2966,2 +2976,3 @@
if( 2 == nUNICODEBytes ){
+ ExchangeWaveDash( (unsigned char *)pWork ); /* 2004/04/23 じゅうじ */
j = wctomb( (char*)pDes, ((wchar_t*)pWork)[0] );
@@ -3090,2 +3101,3 @@
/* 変換可能なUnicodeか */
+ ExchangeWaveDash( (unsigned char *)&pszWork[j] ); /* 2004/04/23 じゅうじ */
nUniBytes = wctomb( (char*)NULL, *(wchar_t*)(&pszWork[j]) );
以上