frwite works perfect in local codepages (non 65001). fwrite works perfect in files. fwrite outputs incorrect only when non ASCII symbols are outputed to stdout.
Example: proc getConsoleOutputCP(): cint {. importc: "GetConsoleOutputCP", stdcall, dynlib: "kernel32" .} proc setConsoleOutputCP(codepage: cint): cint {. stdcall, dynlib: "kernel32", importc: "SetConsoleOutputCP", discardable .} let originalOutCP = getConsoleOutputCP() setConsoleOutputCP(65001) echo "Hello, ", "world! ", "Best regards from Nim!" echo "Здравей, ", "свят! ", "Поздравява те Nim" # same in buglarian echo "Hallo Welt, liebe Gr", "üße von Nim" # same in German echo "" write(stdout, "Hello, ", "world! ", "Best regards from Nim!\n") write(stdout, "Здравей, ", "свят! ", "Поздравява те Nim\n") # same in buglarian write(stdout, "Hallo Welt, liebe Gr", "üße von Nim\n") # same in German setConsoleOutputCP(originalOutCP) Output: (Nim 0.15.2) Hello, world! Best regards from Nim! Здравей, свят! Поздравява те Nim Hallo Welt, liebe Grüße von Nim Hello, world! Best regards from Nim! ��дравей, ��вят! ��оздравява те Nim Hallo Welt, liebe Gr��ße von Nim