From d7677e935d836ce91e64af89e78d0c0345a49b7d Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Wed, 18 Jul 2007 16:47:05 -0400 Subject: Added new WindowsStringConverter --- cpp/test/Ice/stringConverter/Client.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'cpp/test/Ice/stringConverter/Client.cpp') diff --git a/cpp/test/Ice/stringConverter/Client.cpp b/cpp/test/Ice/stringConverter/Client.cpp index 795535d6ece..8186e64151e 100644 --- a/cpp/test/Ice/stringConverter/Client.cpp +++ b/cpp/test/Ice/stringConverter/Client.cpp @@ -10,7 +10,14 @@ #include #include #include + +#if defined(ICONV_ON_WINDOWS) +// +// On Windows, Ice/IcongStringConverter.h is not included by Ice/Ice.h +// #include +#endif + #include #include @@ -49,26 +56,34 @@ public: }; static bool useLocale = false; +static bool useIconv = true; int main(int argc, char* argv[]) { Client app; +#ifndef _WIN32 // // Switch to French locale // (we just used the codeset for as default internal code for // initData.stringConverter below) // - -#ifndef _WIN32 + useLocale = (setlocale(LC_ALL, "fr_FR.ISO8859-15") != 0 || setlocale(LC_ALL, "fr_FR.iso885915@euro") != 0); #endif Ice::InitializationData initData; -#if defined(__hpux) +#if defined(_WIN32) && !defined(ICONV_ON_WINDOWS) + // + // 28605 == ISO 8859-15 codepage + // + initData.stringConverter = new Ice::WindowsStringConverter(28605); + useIconv = false; + +#elif defined(__hpux) if(useLocale) { initData.stringConverter = new Ice::IconvStringConverter; @@ -132,11 +147,15 @@ Client::run(int, char*[]) char oe = char(0xBD); // A single character in ISO Latin 9 string msg = string("tu me fends le c") + oe + "ur!"; - cout << "testing iconv string converter"; + cout << "testing string converter"; if(useLocale) { cout << " (using locale)"; } + if(useIconv) + { + cout << " (using iconv)"; + } cout << "..." << flush; wstring wmsg = clientPrx->widen(msg); test(clientPrx->narrow(wmsg) == msg); -- cgit v1.2.3