1 cmd与文件编码无关,我的电脑始总是GBK

GBK

Charset.defaultCharset()和props.get("file.encoding")默认编码由什么决定?cmd eclipse idea处理策略各不相同

Charset.defaultCharset()和props.get("file.encoding")默认编码由什么决定?cmd eclipse idea处理策略各不相同

UTF-8

Charset.defaultCharset()和props.get("file.encoding")默认编码由什么决定?cmd eclipse idea处理策略各不相同

Charset.defaultCharset()和props.get("file.encoding")默认编码由什么决定?cmd eclipse idea处理策略各不相同

 

 

 

2  eclipse如下,与文件编码有关一致

GBK

Charset.defaultCharset()和props.get("file.encoding")默认编码由什么决定?cmd eclipse idea处理策略各不相同

Charset.defaultCharset()和props.get("file.encoding")默认编码由什么决定?cmd eclipse idea处理策略各不相同

UTF-8

Charset.defaultCharset()和props.get("file.encoding")默认编码由什么决定?cmd eclipse idea处理策略各不相同

Charset.defaultCharset()和props.get("file.encoding")默认编码由什么决定?cmd eclipse idea处理策略各不相同

 

3 idea如下,与文件编码无关,我的电脑总是UTF-8

GBK

Charset.defaultCharset()和props.get("file.encoding")默认编码由什么决定?cmd eclipse idea处理策略各不相同

 

UTF-8

Charset.defaultCharset()和props.get("file.encoding")默认编码由什么决定?cmd eclipse idea处理策略各不相同

 

idea深入研究

打开idea设置,有两个参数Global encoding,Project encoding

优先级:Project encoding  > Global encoding > 系统默认。类似git:local(project) > global(user) > system

所以:

1、Project encoding只要不是"<System Default>"则以Project encoding的编码为准;

2、Project encoding如果是"<System Default>"则以Global encoding的编码为准;

3、Project encoding和Global encoding都是"<System Default>"则以系统的编码为准。

4、idea中默认 Project encoding是"<System Default>",Global encoding是UTF-8

Charset.defaultCharset()和props.get("file.encoding")默认编码由什么决定?cmd eclipse idea处理策略各不相同

 

 

结论:IDEA和eclipse这种IDE对编码做了处理,而cmd直接以系统编码为准

相关文章:

  • 2021-05-24
  • 2021-11-15
  • 2021-12-07
  • 2021-05-21
  • 2021-11-20
  • 2021-04-26
  • 2021-09-11
  • 2022-02-10
猜你喜欢
  • 2021-09-03
  • 2021-12-09
  • 2022-03-04
  • 2021-08-01
  • 2021-11-13
相关资源
相似解决方案