How to determine the character encoding that a terminal uses in a C/C++ program?

I’ve noticed that SyncTERM uses a different character encoding than the default MacOS terminal emulator, and they’re incompatible with one another. For example, say you want to print a block character in a format string. In SyncTERM, which uses the IBM Extended ASCII character encoding, you would use an octal escape sequence like 261. In Terminal.app (and probably iTerm2 as well), this just prints a question mark. Since these terminals use UTF-8, you need to use the uxxxx escape sequence.

Some apps doesn’t accept some characters from the «Compose» key

The problem is that the compose key works fine, but some application doesn’t accept some characters from it. E.g. I can type the character in Emacs (Compose+8+8), but this won’t work in FireFox, Konsole and Kate. But many other characters, e.g. typed there (in FireFox, Konsole and Kate) with Compose work just fine. Also I may insert a problem symbols with a simple copy-paste (from any of two clipboards).