#323:
 1) fixing code style;
 2) fixing erroneously used NSStringEncodingConversionAllowLossy
 3) fixing targets
 4) fixing encoding in logging
 5) eliminating code duplication