Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default file encoding for daemon should be UTF-8 #2270

Open
lptr opened this issue Jun 9, 2017 · 4 comments
Open

Default file encoding for daemon should be UTF-8 #2270

lptr opened this issue Jun 9, 2017 · 4 comments
Labels
a:feature A new functionality in:daemon
Milestone

Comments

@lptr
Copy link
Member

lptr commented Jun 9, 2017

Currently we don't set the file.encoding property when starting daemons. Most systems default to UTF-8, but Windows typically uses CP-1252. The difference in default encoding can produce incorrect results by reusing cached task outputs from a shared cache when used by different OSs.

The real solution is for tasks to always declare all their inputs, even the default file encoding if they rely on it. However, this is easy to forget, as even some built-in tasks in Gradle don't do this (these should be fixed as a separate issue). By defaulting to UTF-8 we are making this discrepancy go away.

Users who need to set a different default encoding can make it explicit via org.gradle.jvmargs=-Dfile.encoding=....

Expected Behavior

Daemon is started with utf-8 as the default encoding.

Current Behavior

Daemon is started with the system default encoding. Changing the system default encoding does not change the default encoding for an already running daemon.

Context

Tasks that rely on file.encoding but don't declare it as an input can reuse cached results produced with a default encoding.

@comdiv
Copy link

comdiv commented Apr 11, 2019

Cannot set UTF-8 properties in gradle.properties if Windows is used for compilation - it read them as CP-1251 (in my case)

@bmuskalla bmuskalla added this to the Unscheduled milestone Jun 4, 2020
@lptr lptr modified the milestones: Unscheduled, 7.0 RC1 Dec 10, 2020
@jjohannes jjohannes added the @core Issue owned by GBT Core label Feb 3, 2021
@lptr lptr modified the milestones: 7.0 RC1, 7.1 RC1 Feb 4, 2021
@jjohannes jjohannes removed this from the 7.1 RC1 milestone Mar 22, 2021
@jjohannes jjohannes removed the @core Issue owned by GBT Core label Mar 22, 2021
@irgaly
Copy link

irgaly commented Feb 4, 2022

Any roadmap for this?
I'll feel happy if we don't have to write org.gradle.jvmargs=-Dfile.encoding=... in gradle.properties any more.

@ljacomet
Copy link
Member

Related issue: #19952

@eskatos eskatos added this to the 9.0 RC1 milestone Jan 20, 2023
@ov7a
Copy link
Member

ov7a commented Aug 8, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:daemon
Projects
None yet
Development

No branches or pull requests

10 participants