Create getEncodingFromString method