mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-05-23 15:39:57 +08:00
Use utf-8 on Windows
This commit is contained in:
4
chsrc.c
4
chsrc.c
@ -107,7 +107,7 @@ static const char const
|
|||||||
pl_ruby, pl_python, pl_nodejs, pl_perl, pl_php, pl_cran,
|
pl_ruby, pl_python, pl_nodejs, pl_perl, pl_php, pl_cran,
|
||||||
pl_rust, pl_go, pl_dotnet, pl_maven, pl_gradle, pl_julia
|
pl_rust, pl_go, pl_dotnet, pl_maven, pl_gradle, pl_julia
|
||||||
};
|
};
|
||||||
#undef arg
|
#undef cmdfunc
|
||||||
|
|
||||||
static const char const*
|
static const char const*
|
||||||
usage[] = {
|
usage[] = {
|
||||||
@ -145,6 +145,8 @@ print_help ()
|
|||||||
int
|
int
|
||||||
main (int argc, char const *argv[])
|
main (int argc, char const *argv[])
|
||||||
{
|
{
|
||||||
|
xy_useutf8();
|
||||||
|
|
||||||
// 未提供参数时
|
// 未提供参数时
|
||||||
if (argc<=1) {
|
if (argc<=1) {
|
||||||
print_help(); return 0;
|
print_help(); return 0;
|
||||||
|
7
helper.h
7
helper.h
@ -12,6 +12,13 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#define xy_useutf8() SetConsoleOutputCP(65001)
|
||||||
|
#else
|
||||||
|
#define xy_useutf8()
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||||
|
|
||||||
char*
|
char*
|
||||||
|
Reference in New Issue
Block a user