long (@Nullable String encodingName) { if (StringUtil.isEmptyOrSpaces(encodingName)) return -1; ID converted = nsString(encodingName); long cfEncoding = myFoundationLibrary.CFStringConvertIANACharSetNameToEncoding(converted); ID restored = myFoundationLibrary.CFStringConvertEncodingToIANACharSetName(cfEncoding); if (ID.NIL.equals(restored)) return -1; return convertCFEncodingToNS(cfEncoding); }