Platform's default charset on different platforms?

后端 未结 2 1832
无人及你
无人及你 2020-12-03 04:47

Some legacy code relies on the platform\'s default charset for translations. For Windows and Linux installations in the \"western world\" I know what that means. But thinkin

2条回答
  •  生来不讨喜
    2020-12-03 05:31

    That's a user specific setting. On many modern Linux systems, it's UTF-8. On Macs, it’s MacRoman. In the US on Windows, it's often CP1250, in Europe it's CP1252. In China, you often find simplified chinese (Big5 or a GB*).

    But that’s the system default, which each user can change at any time. Which is probably the solution: Set the encoding when you start your app using the system property file.encoding

    See this answer how to do that. I suggest to put this into a small script which starts your app, so the user default isn't tainted.

提交回复
热议问题