Add specific platform encoding functions for FreeBSD, OpenBSD and NetBSD

Supports ASCII, UTF-8 and Latin-1 locales;
Uses slightly adjusted version of the linux-specific encoding functions