more wchar_t tests
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7029 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
//#define TEST_CMDLINE
|
//#define TEST_CMDLINE
|
||||||
//#define TEST_DATETIME
|
//#define TEST_DATETIME
|
||||||
//#define TEST_DIR
|
//#define TEST_DIR
|
||||||
#define TEST_DLLLOADER
|
//#define TEST_DLLLOADER
|
||||||
//#define TEST_EXECUTE
|
//#define TEST_EXECUTE
|
||||||
//#define TEST_FILECONF
|
//#define TEST_FILECONF
|
||||||
//#define TEST_HASH
|
//#define TEST_HASH
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
//#define TEST_STRINGS
|
//#define TEST_STRINGS
|
||||||
//#define TEST_THREADS
|
//#define TEST_THREADS
|
||||||
//#define TEST_TIMER
|
//#define TEST_TIMER
|
||||||
//#define TEST_WCHAR
|
#define TEST_WCHAR
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
@@ -1072,14 +1072,31 @@ static void TestUtf8()
|
|||||||
{
|
{
|
||||||
puts("*** Testing UTF8 support ***\n");
|
puts("*** Testing UTF8 support ***\n");
|
||||||
|
|
||||||
wxString testString =
|
wxString testString = "français";
|
||||||
|
#if 0
|
||||||
"************ French - Français ****************"
|
"************ French - Français ****************"
|
||||||
"Juste un petit exemple pour dire que les français aussi"
|
"Juste un petit exemple pour dire que les français aussi"
|
||||||
"ont à cœur de pouvoir utiliser tous leurs caractères ! :)";
|
"ont à cœur de pouvoir utiliser tous leurs caractères ! :)";
|
||||||
|
#endif
|
||||||
|
|
||||||
wxWCharBuffer wchBuf = testString.wc_str(wxConvUTF8);
|
wxWCharBuffer wchBuf = testString.wc_str(wxConvUTF8);
|
||||||
printf("Decoding '%s' => '%s'\n",
|
const wchar_t *pwz = (const wchar_t *)wchBuf;
|
||||||
testString.c_str(), wxString(wchBuf, wxConvCurrent).c_str());
|
wxString testString2(pwz, wxConvLocal);
|
||||||
|
|
||||||
|
printf("Decoding '%s' => '%s'\n", testString.c_str(), testString2.c_str());
|
||||||
|
|
||||||
|
char *psz = "fran" "\xe7" "ais";
|
||||||
|
size_t len = strlen(psz);
|
||||||
|
wchar_t *pwz2 = new wchar_t[len + 1];
|
||||||
|
for ( size_t n = 0; n <= len; n++ )
|
||||||
|
{
|
||||||
|
pwz2[n] = (wchar_t)(unsigned char)psz[n];
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString testString3(pwz2, wxConvUTF8);
|
||||||
|
delete [] pwz2;
|
||||||
|
|
||||||
|
printf("Encoding '%s' -> '%s'\n", psz, testString3.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TEST_WCHAR
|
#endif // TEST_WCHAR
|
||||||
|
Reference in New Issue
Block a user