3

javac says

If the -encoding option is not specified, then the platform default converter is used.

I guess the default encoding in Linux is UTF-8, how to get the default encoding in Linux?

6

javac will use the default encoding with which it has been configured. Often this corresponds to whatever your system's default locale "codeset" happens to be, but there actually is no guarantee that they are the same. The JVM does not pay attention to the locale environment variables.

The term "codeset" is (almost) synonymous with "charset set" or "encoding".

Further reading:

0

Not sure if that's what you're asking, but you can see your encodings by running locale. Example:

malice@Haskell ~ $ locale
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
  • Technically, locale does not show the encoding, but the encoding-name is by convention part of the locale settings. – Thomas Dickey Dec 24 '15 at 12:41
0

on ubuntu 14 , you can use this quick command:

    # env |grep LANG

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.