JEP 400 - UTF-8 by Default

Jan Lahoda jan.lahoda at oracle.com
Mon Aug 30 08:17:27 UTC 2021


On 29. 08. 21 12:19, Attila Kelemen wrote:

> Hi,
>
> I have read the description of JEP 400, but it does not mention the 
> default source encoding. Will javac be changed as well?


As far as I can tell, the default encoding that javac itself uses is 
`Charset.defaultCharset().name()`. So I think that when 
`Charset.defaultCharset().name()` starts to return "UTF-8", javac will 
start to read the source files in the UTF-8 encoding, unless a different 
encoding is specified in a javac option, or unless the javac is invoked 
with a custom JavaFileManager which does the conversion on its own.


Jan


>
> Given that standard APIs change, it would be nice, since platform 
> dependent encoding was just a nuisance anyway, and (at least to me) 
> seems a lot less risky than the standard API change.
>
> Thanks,
> Attila


More information about the compiler-dev mailing list