Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kumir2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kumir
kumir2
Commits
780d4a21
Commit
780d4a21
authored
Sep 06, 2013
by
Victor Yacovlev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: Fixed ANSI/OEM encoding for console tools
parent
f6528637
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
20 deletions
+16
-20
src/app/main.cpp
src/app/main.cpp
+7
-1
src/plugins/kumircompilertool/kumircompilertoolplugin.cpp
src/plugins/kumircompilertool/kumircompilertoolplugin.cpp
+9
-19
No files found.
src/app/main.cpp
View file @
780d4a21
...
...
@@ -177,7 +177,13 @@ public:
if
(
mustShowHelpAndExit
)
{
if
(
splashScreen_
)
splashScreen_
->
finish
(
0
);
fprintf
(
stderr
,
"%s"
,
qPrintable
(
manager
->
commandLineHelp
()));
const
QString
msg
=
manager
->
commandLineHelp
();
#ifdef Q_OS_WIN32
QTextCodec
*
codec
=
QTextCodec
::
codecForName
(
"CP866"
);
fprintf
(
stderr
,
"%s"
,
codec
->
fromUnicode
(
msg
).
constData
());
#else
fprintf
(
stderr
,
"%s"
,
msg
.
toLocal8Bit
().
data
());
#endif
exit
(
0
);
return
;
}
...
...
src/plugins/kumircompilertool/kumircompilertoolplugin.cpp
View file @
780d4a21
...
...
@@ -21,7 +21,7 @@ KumirCompilerToolPlugin::KumirCompilerToolPlugin()
:
KPlugin
()
,
analizer_
(
nullptr
)
,
generator_
(
nullptr
)
,
useAnsiWindowsOutput_
(
fals
e
)
,
useAnsiWindowsOutput_
(
tru
e
)
{
}
...
...
@@ -30,11 +30,11 @@ KumirCompilerToolPlugin::acceptableCommandLineParameters() const
{
using
ExtensionSystem
::
CommandLineParameter
;
QList
<
CommandLineParameter
>
result
;
result
<<
CommandLineParameter
(
false
,
'a'
,
"ansi"
,
tr
(
"Show error messages in console using CP1251 encoding instead of CP866 (Windows only)"
)
);
//
result << CommandLineParameter(
//
false,
//
'a', "ansi",
//
tr("Show error messages in console using CP1251 encoding instead of CP866 (Windows only)")
//
);
result
<<
CommandLineParameter
(
false
,
'e'
,
"encoding"
,
...
...
@@ -126,12 +126,7 @@ void KumirCompilerToolPlugin::start()
": "
+
e
.
code
;
#ifdef Q_OS_WIN32
QTextCodec
*
cp866
=
QTextCodec
::
codecForName
(
"CP866"
);
if
(
useAnsiWindowsOutput_
)
{
std
::
cerr
<<
cp866
->
fromUnicode
(
errorMessage
).
data
();
}
else
{
std
::
cerr
<<
errorMessage
.
toLocal8Bit
().
data
();
}
fprintf
(
stderr
,
"%s
\n
"
,
cp866
->
fromUnicode
(
errorMessage
).
constData
());
#else
std
::
cerr
<<
errorMessage
.
toLocal8Bit
().
data
();
#endif
...
...
@@ -165,15 +160,10 @@ void KumirCompilerToolPlugin::start()
qApp
->
setProperty
(
"returnCode"
,
errors
.
isEmpty
()
?
0
:
1
);
}
else
{
const
QString
errorMessage
=
tr
(
"Can't open file %1"
).
arg
(
filename
);
const
QString
errorMessage
=
tr
(
"Can't open file %1"
).
arg
(
QDir
::
toNativeSeparators
(
filename
)
);
#ifdef Q_OS_WIN32
QTextCodec
*
cp866
=
QTextCodec
::
codecForName
(
"CP866"
);
if
(
useAnsiWindowsOutput_
)
{
std
::
cerr
<<
cp866
->
fromUnicode
(
errorMessage
).
data
();
}
else
{
std
::
cerr
<<
errorMessage
.
toLocal8Bit
().
data
();
}
fprintf
(
stderr
,
"%s
\n
"
,
cp866
->
fromUnicode
(
errorMessage
).
constData
());
#else
std
::
cerr
<<
errorMessage
.
toLocal8Bit
().
data
();
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment