diff options
-rw-r--r-- | compiler/commands.nim | 9 | ||||
-rw-r--r-- | lib/system.nim | 5 | ||||
-rw-r--r-- | web/news/version_0_15_released.rst | 4 |
3 files changed, 17 insertions, 1 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim index 48926f602..de1197292 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -217,6 +217,15 @@ proc testCompileOptionArg*(switch, arg: string, info: TLineInfo): bool = of "none": result = gOptions * {optOptimizeSpeed, optOptimizeSize} == {} else: localError(info, errNoneSpeedOrSizeExpectedButXFound, arg) of "verbosity": result = $gVerbosity == arg + of "app": + case arg.normalize + of "gui": result = contains(gGlobalOptions, optGenGuiApp) + of "console": result = not contains(gGlobalOptions, optGenGuiApp) + of "lib": result = contains(gGlobalOptions, optGenDynLib) and + not contains(gGlobalOptions, optGenGuiApp) + of "staticlib": result = contains(gGlobalOptions, optGenStaticLib) and + not contains(gGlobalOptions, optGenGuiApp) + else: localError(info, errGuiConsoleOrLibExpectedButXFound, arg) else: invalidCmdLineOption(passCmd1, switch, info) proc testCompileOption*(switch: string, info: TLineInfo): bool = diff --git a/lib/system.nim b/lib/system.nim index 6a9b52d24..c2b45e01d 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -3670,3 +3670,8 @@ template closureScope*(body: untyped): untyped = when defined(nimconfig): include "system/nimscript" + +when defined(windows) and appType == "console": + proc setConsoleOutputCP(codepage: cint): cint {.stdcall, dynlib: "kernel32", + importc: "SetConsoleOutputCP".} + discard setConsoleOutputCP(65001) # 65001 - utf-8 codepage \ No newline at end of file diff --git a/web/news/version_0_15_released.rst b/web/news/version_0_15_released.rst index b9c9bc50b..1e35fb627 100644 --- a/web/news/version_0_15_released.rst +++ b/web/news/version_0_15_released.rst @@ -26,7 +26,7 @@ Changes affecting backwards compatibility Warning: a [b] will be parsed as command syntax; spacing is deprecated - See `https://github.com/nim-lang/Nim/issues/3898`_ for the relevant + See `<https://github.com/nim-lang/Nim/issues/3898>`_ for the relevant discussion. - Overloading the special operators ``.``, ``.()``, ``.=``, ``()`` now should be enabled via ``{.experimental.}``. @@ -52,6 +52,8 @@ that have tuple name: var rocketaims = initOrderedTable[string, Table[tuple[k: int8, v: int8], int64] ]() rocketaims["hi"] = {(k: -1.int8, v: 0.int8): 0.int64}.toTable() +- Now when you compile console application for Windows, console output + encoding is automatically set to UTF-8. Library Additions ----------------- |