JEP 400 - UTF-8 by Default
Naoto Sato
naoto.sato at oracle.com
Mon Aug 30 17:00:05 UTC 2021
Yes, that is correct.
As long as javac uses the default encoding from
`Charset.defaultCharset()`, it will automatically use `UTF-8` as the
default encoding for the input source files.
Naoto
On 8/30/21 1:17 AM, Jan Lahoda wrote:
> 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