*** ogr/ogrutils.cpp Fri Nov 2 10:47:34 2012
--- ../gdal_new/ogr/ogrutils.cpp Fri Nov 2 12:28:33 2012
***************
*** 754,760 ****
/* -------------------------------------------------------------------- */
else
{
! papszReturn = CSLAddString( papszReturn, papszArgv[iArg] );
}
}
--- 754,762 ----
/* -------------------------------------------------------------------- */
else
{
! char* pszTmp = CPLRecodeCommandInput( papszArgv[iArg] );
! papszReturn = CSLAddString( papszReturn, pszTmp );
! CPLFree(pszTmp);
}
}
*** port/cpl_string.h Fri Nov 2 10:47:29 2012
--- ../gdal_new/port/cpl_string.h Fri Nov 2 12:29:27 2012
***************
*** 177,182 ****
--- 177,184 ----
const char *pszDstEncoding ) CPL_WARN_UNUSED_RESULT;
int CPL_DLL CPLIsUTF8(const char* pabyData, int nLen);
char CPL_DLL *CPLForceToASCII(const char* pabyData, int nLen, char chReplacementChar) CPL_WARN_UNUSED_RESULT;
+ char CPL_DLL *CPLRecodeCommandInput( const char* pszSource ) CPL_WARN_UNUSED_RESULT;
+ char CPL_DLL *CPLRecodeCommandOutput( const char* pszSource ) CPL_WARN_UNUSED_RESULT;
CPL_C_END
*** port/cpl_recode.cpp Fri Nov 2 10:47:30 2012
--- ../gdal_new/port/cpl_recode.cpp Fri Nov 2 12:16:08 2012
***************
*** 324,329 ****
--- 324,372 ----
return -1;
}
+
+ /************************************************************************/
+ /* CPLRecodeCommandInput() */
+ /************************************************************************/
+ /**
+ * Convert a string from a platform encoding to UTF-8, effects only windows platform.
+ *
+ * There is a I/O problem in windows command line character arguments.
+ * Unfortunately, Run batch file written in UTF-8 fails some case.
+ *
+ * @return a NULL terminated string which should be freed with CPLFree().
+ */
+
+ char CPL_DLL *CPLRecodeCommandInput( const char* pszSource )
+
+ {
+ #ifdef _WIN32
+ return CPLRecode( pszSource, "CP0", CPL_ENC_UTF8 );
+ #else
+ return CPLStrdup(pszSource);
+ #endif
+ }
+
+ /************************************************************************/
+ /* CPLRecodeCommandOutput() */
+ /************************************************************************/
+ /**
+ * Convert a string from UTF-8 to a platform encoding, effects only windows platform.
+ *
+ * There is a I/O problem in windows command line character arguments.
+ *
+ * @return a NULL terminated string which should be freed with CPLFree().
+ */
+ char CPL_DLL *CPLRecodeCommandOutput( const char* pszSource )
+
+ {
+ #ifdef _WIN32
+ return CPLRecode( pszSource, CPL_ENC_UTF8, "CP0" );
+ #else
+ return CPLStrdup(pszSource);
+ #endif
+ }
+
/************************************************************************/
/* CPLClearRecodeWarningFlags() */
/************************************************************************/
*** port/cpl_recode_stub.cpp Fri Nov 2 10:47:29 2012
--- ../gdal_new/port/cpl_recode_stub.cpp Fri Nov 2 11:43:30 2012
***************
*** 166,172 ****
&& strcmp(pszDstEncoding,CPL_ENC_UTF8) == 0 )
{
int nCode = atoi( pszSrcEncoding + 2 );
! if( nCode > 0 ) {
return CPLWin32Recode( pszSource, nCode, CP_UTF8 );
}
}
--- 166,172 ----
&& strcmp(pszDstEncoding,CPL_ENC_UTF8) == 0 )
{
int nCode = atoi( pszSrcEncoding + 2 );
! if( nCode >= 0 ) {
return CPLWin32Recode( pszSource, nCode, CP_UTF8 );
}
}
***************
*** 178,184 ****
&& strncmp(pszDstEncoding,"CP",2) == 0 )
{
int nCode = atoi( pszDstEncoding + 2 );
! if( nCode > 0 ) {
return CPLWin32Recode( pszSource, CP_UTF8, nCode );
}
}
--- 178,184 ----
&& strncmp(pszDstEncoding,"CP",2) == 0 )
{
int nCode = atoi( pszDstEncoding + 2 );
! if( nCode >= 0 ) {
return CPLWin32Recode( pszSource, CP_UTF8, nCode );
}
}
2012/11/05 追記:やっぱ、GDAL-dev ML に投下しました。
2012年11月2日金曜日
GDAL patch 投下
とりあえず、QGisのコミュニティのCavaliniさんに、パッチを渡してみましたが、QGis の問題というよりもGDALの問題なんで、GDAL-developer ML に投下した方が良いのかも?
ただ前回、短いpatchだからOKかも?と思ってGDAL-dev MLにパッチ投稿したら、MLへのpatch投下は、やっぱり遠慮して欲しいと言われたので、説明をした上で、どなたかにパッチを送るという手順になりそう。 アカウントは登録されているはずなんだけど、OSGeo の track にログインできないので、track に直接投下できなくて、困ってるのだ…。
パッチは、version 'gdal-2.0dev'
https://svn.osgeo.org/gdal/trunk/gdal
のもので、新しくコマンドライン引数を管理するクラスが生成されていたので、ちょこっと直すだけで、コマンドライン型アプリ全部に適用されそうです。
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿