2

I am using log4j2 to log message on aix system. In log when I use command less I can see:

...|LU?N
...|NOV�K
...|ZEM�NEK

when I copy same file on my ubunty system and use same program I can see:

...|LU?N<DD>
...|NOV<C1>K
...|ZEM<C1>NEK

so there is something wrong in my log4j2 configuration so I add charset="UTF-8"

now on aix system I can see:

...|LUŽN<9D>
...|NOV<81>K
...|ZEM<81>NEK

but when I copy to my ubuntu I can see right values:

...|LUŽNÝ
...|NOVÁK
...|ZEMÁNEK

So my question is what encoding should I use to see right values on aix and ubuntu system

1

Set the environment variable LC_CTYPE to the value en_US.UTF-8 to indicate that you want to use the UTF-8 encoding for characters on terminals. UTF-8 is an encoding of Unicode. It is the modern character encoding standard in the Unix world in general, and it is the default on Ubuntu, but it might not be the default on AIX.

The first release of AIX that supports UTF-8 locales is 7.1.2.0. If you have an older version, you might not be able to view UTF-8 encoded text on AIX. However, if you're accessing the AIX machine over SSH from Ubuntu, setting LC_CTYPE=C (or leaving it unset) should work with simple programs such as cat. For other programs such as vi or less, you'll get display glitches as they aren't aware of how several bytes make up a single character.

Alternatively, if you only want the characters you show, you can use the latin2 a.k.a ISO-8859-2 character set. On Ubuntu, in a terminal, you can switch to working in latin2 by running the the command

LC_CTYPE=cs_CZ luit

(Or with any other latin2 locale. If the locale doesn't exist, generate it with sudo locale-gen cs_CZ.)

  • regarding "The first release of AIX that supports UTF-8 locales is 7.1.2.0" - that is not correct, for the common locales the UTF-8 support is in place since AIX 5.2 and even earlier. Following your link, in Table 1. check the column "Codeset" and the rightmost colum. Even 4.3 had UTF-8 support, see e.g. ualberta.ca/dept/chemeng/AIX-43/share/man/info/en_US/a_doc_lib/… And depending on the language, the OP might need to install additional filesets for UTF-8 support for his locale and depending on the installation. – doktor5000 Aug 23 '15 at 17:42

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.