Commit 5bd67f08 authored by Victor Yacovlev's avatar Victor Yacovlev

Implemented WIN32 using of CP1251 instead of CP866

parent 81c86ffb
......@@ -2296,15 +2296,9 @@ public:
}
// Actual functions to be in use while input from stream
static Encoding LOCALE_ENCODING;
#if !defined(LOCALE_ENCODING)
# if defined(WIN32) || defined(_WIN32)
# define LOCALE_ENCODING CP866
# else
# define LOCALE_ENCODING UTF8
# endif
#endif
// Actual functions to be in use while input from stream
static InputStream makeInputStream(FileType fileNo, bool fromStdIn) {
if (fromStdIn) {
......@@ -2504,6 +2498,11 @@ std::deque<FileType> Files::openedFiles;
std::deque<FILE*> Files::openedFileHandles;
FILE * Files::assignedIN = stdin;
FILE * Files::assignedOUT = stdout;
#if defined(WIN32) || defined(_WIN32)
Encoding IO::LOCALE_ENCODING = CP866;
#else
Encoding IO::LOCALE_ENCODING = UTF8;
#endif
Encoding Files::fileEncoding;
String Kumir::IO::inputDelimeters = Kumir::Core::fromAscii(" \n\t");
#endif
......
......@@ -5,11 +5,7 @@
#include "vm/vm_bytecode.hpp"
#include "vm/vm.hpp"
#if !defined(WIN32) && !defined(_WIN32)
#define LOCALE Kumir::UTF8
#else
#define LOCALE Kumir::CP866
#endif
static Kumir::Encoding LOCALE;
int usage(const char * programName)
{
......@@ -378,6 +374,11 @@ int main(int argc, char *argv[])
{
// sleep(15); // for remote debugger
// Look at arguments
#if defined(WIN32) || defined(_WIN32)
Kumir::IO::LOCALE_ENCODING = LOCALE = Kumir::CP866;
#else
Kumir::IO::LOCALE_ENCODING = LOCALE = Kumir::UTF8;
#endif
std::string programName;
std::deque<std::string> args;
bool forceTextForm = false;
......@@ -387,9 +388,12 @@ int main(int argc, char *argv[])
continue;
static const std::string minuss("-s");
static const std::string minusS("-S");
static const std::string minusansi("-ansi");
if (programName.empty()) {
if (arg==minuss || arg==minusS)
forceTextForm = true;
else if (arg==minusansi)
Kumir::IO::LOCALE_ENCODING = LOCALE = Kumir::CP1251;
else
programName = arg;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment