public NSData Encode(NSString text, uint encoding) { Contract.Requires((object) text != null, "text is null"); Contract.Requires(encoding != 0, "encoding is zero"); return text.dataUsingEncoding_allowLossyConversion(encoding, false); // TODO: might want to popup a warning if we lose stuff like accents }