summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/src/IceBox/Admin.cpp1
-rw-r--r--cpp/src/IceGrid/Client.cpp11
-rw-r--r--cpp/src/IceGrid/Parser.cpp12
-rw-r--r--cpp/src/IceStorm/Admin.cpp14
-rw-r--r--cpp/src/IceStorm/Parser.cpp18
5 files changed, 42 insertions, 14 deletions
diff --git a/cpp/src/IceBox/Admin.cpp b/cpp/src/IceBox/Admin.cpp
index c7c76bac161..822f144dc5e 100644
--- a/cpp/src/IceBox/Admin.cpp
+++ b/cpp/src/IceBox/Admin.cpp
@@ -91,7 +91,6 @@ Client::run(int argc, char* argv[])
return EXIT_FAILURE;
}
-
ObjectPrxPtr base = communicator()->propertyToProxy("IceBoxAdmin.ServiceManager.Proxy");
if(base == 0)
diff --git a/cpp/src/IceGrid/Client.cpp b/cpp/src/IceGrid/Client.cpp
index c0c58603453..8dafd14f4ed 100644
--- a/cpp/src/IceGrid/Client.cpp
+++ b/cpp/src/IceGrid/Client.cpp
@@ -31,6 +31,8 @@
# include <termios.h>
#else
# include <conio.h>
+# include <fcntl.h>
+# include <io.h>
#endif
using namespace std;
@@ -256,14 +258,17 @@ interruptCallback(int /*signal*/)
int
wmain(int argc, wchar_t* argv[])
-
+{
+ //
+ // Enable binary input mode for stdin to avoid automatic conversions.
+ //
+ _setmode(_fileno(stdin), _O_BINARY);
#else
int
main(int argc, char* argv[])
-
-#endif
{
+#endif
Client app;
StringSeq args = argsToStringSeq(argc, argv);
return app.main(args);
diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp
index 7a88d5247a6..28b09bb87dc 100644
--- a/cpp/src/IceGrid/Parser.cpp
+++ b/cpp/src/IceGrid/Parser.cpp
@@ -2654,9 +2654,7 @@ Parser::getInput(char* buf, size_t& result, size_t maxSize)
}
}
#else
-
cout << parser->getPrompt() << flush;
-
string line;
while(true)
{
@@ -2669,14 +2667,19 @@ Parser::getInput(char* buf, size_t& result, size_t maxSize)
}
break;
}
- line += c;
+ line += c;
if(c == '\n')
{
break;
}
}
-
+#ifdef _WIN32
+ if(windowsConsoleConverter)
+ {
+ line = nativeToUTF8(line, windowsConsoleConverter);
+ }
+#endif
result = line.length();
if(result > maxSize)
{
@@ -2688,7 +2691,6 @@ Parser::getInput(char* buf, size_t& result, size_t maxSize)
{
strcpy(buf, line.c_str());
}
-
#endif
}
}
diff --git a/cpp/src/IceStorm/Admin.cpp b/cpp/src/IceStorm/Admin.cpp
index 865139f91a0..60c206b116a 100644
--- a/cpp/src/IceStorm/Admin.cpp
+++ b/cpp/src/IceStorm/Admin.cpp
@@ -12,6 +12,11 @@
#include <Ice/SliceChecksums.h>
#include <IceStorm/Parser.h>
+#ifdef _WIN32
+# include <fcntl.h>
+# include <io.h>
+#endif
+
using namespace std;
using namespace Ice;
using namespace IceStorm;
@@ -28,14 +33,17 @@ public:
int
wmain(int argc, wchar_t* argv[])
-
+{
+ //
+ // Enable binary input mode for stdin to avoid automatic conversions.
+ //
+ _setmode(_fileno(stdin), _O_BINARY);
#else
int
main(int argc, char* argv[])
-
-#endif
{
+#endif
Client app;
Ice::InitializationData id;
Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
diff --git a/cpp/src/IceStorm/Parser.cpp b/cpp/src/IceStorm/Parser.cpp
index ca0c0c5ae7b..df8decb2e14 100644
--- a/cpp/src/IceStorm/Parser.cpp
+++ b/cpp/src/IceStorm/Parser.cpp
@@ -30,6 +30,10 @@ namespace IceStorm
Parser* parser;
+#ifdef _WIN32
+Ice::StringConverterPtr windowsConsoleConverter = 0;
+#endif
+
}
namespace
@@ -489,13 +493,17 @@ Parser::getInput(char* buf, size_t& result, size_t maxSize)
}
line += c;
-
if(c == '\n')
{
break;
}
}
-
+#ifdef _WIN32
+ if(windowsConsoleConverter)
+ {
+ line = nativeToUTF8(line, windowsConsoleConverter);
+ }
+#endif
result = line.length();
if(result > maxSize)
{
@@ -661,6 +669,12 @@ Parser::Parser(const CommunicatorPtr& communicator, const TopicManagerPrx& admin
_defaultManager(admin),
_managers(managers)
{
+#ifdef _WIN32
+ if(!windowsConsoleConverter)
+ {
+ windowsConsoleConverter = Ice::createWindowsStringConverter(GetConsoleOutputCP());
+ }
+#endif
}
void