Skip to content

LF is automatically converted to CRLF #25640

@ekfacile

Description

@ekfacile

Describe the bug

When LF (\n) is output to standard output, it is somehow converted to CRLF (\r\n) and output.

The print command outputs exactly what is written, so the command and the actual behavior are inconsistent.

If you specify LF in the print command, it must output LF as is.

Reproduction Steps

Save the below code as main.v.

print('\n')

Run it from the command prompt.

v run main.v > test.txt

If you open test.txt in a binary editor, you will see the following data:

0D 0A

As you can see from the table below, LF is always converted to CRLF.

Original code Ourput code
\r \r
\n \r\n
\r\n \r\r\n

Expected Behavior

It is desirable that LF is output as is.

0A

Current Behavior

LF is automatic converted to CRLF.

0D 0A

Possible Solution

LF is output as LF.

You don't need to consider platform differences.

Additional Information/Context

I am using v.exe built with GCC on MSYS2 + MinGW (UCRT64) on the Windows command prompt.

V version

0.4.12 92eb6cf

Environment details (OS name and version, etc.)

V full version V 0.4.12 b0198f2.92eb6cf
OS windows, Microsoft Windows 11 Pro 26200 64 ビット
Processor 12 cpus, 64bit, little endian, AMD Ryzen 5 3600 6-Core Processor
Memory 11.71GB/15.92GB
V executable W:\Datas\Projects\msys2\v\v.exe
V last modified time 2025-10-31 23:59:51
V home dir OK, value: W:\Datas\Projects\msys2\v
VMODULES OK, value: C:\Users\UserName.vmodules
VTMP OK, value: Y:\msys64\tmp\v_0
Current working dir OK, value: Y:\msys64\home\UserName
env CFLAGS "-O3 -march=znver2 -pipe"
Git version git version 2.51.2
V git status 92eb6cf-dirty
.git/config present true
cc version cc (Rev8, Built by MSYS2 project) 15.2.0
gcc version gcc (Rev8, Built by MSYS2 project) 15.2.0
clang version N/A
msvc version N/A
tcc version tcc version 0.9.27 (x86_64 Windows)
tcc git status thirdparty-windows-amd64 b425ac82
emcc version N/A
glibc version ldd (cygwin) 3.6.5

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions