fix bugs of empty scm_info
improve encoding handling