-(NSString *) savefiletodocuments: (NSString *) url{//nsstring *url = @ "http://172.28.250.70/ad/20140210151602.jpg";NSString*filename =[url lastpathcomponent]; NSString*resultfilepath =@""; if(Url.length >7) {NSString*destfolderpath = [[Nshomedirectory () stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"iadimages"]; NSString*destfilepath =[Destfolderpath Stringbyappendingpathcomponent:url]; if(! [[Nsfilemanager Defaultmanager] Fileexistsatpath:destfolderpath]) {//determine if a folder exists[[Nsfilemanagerdefaultmanager] Createdirectoryatpath:destfolderpath Withintermediatedirectorie S:yesattributes:nilerror:nil]; } if([[[Nsfilemanager Defaultmanager] Fileexistsatpath:destfilepath]) {//determine if a file existsResultfilepath=Destfilepath; } Else{NSData*imagedata =[NSData Datawithcontentsofurl:[nsurl Urlwithstring:url]; if([ImageData writetofile:destfilepath Atomically:yes]) {Resultfilepath=Destfilepath; } Else{Resultfilepath=Destfilepath; } } } returnResultfilepath;} -(nsstring*) utf8_to_gb2312: (nsstring*) utf8string{nsstringencoding encoding=cfstringconvertencodingtonsstringencoding (kcfstringencodinggb_18030_2000); NSData* Gb2312data =[utf8string datausingencoding:encoding]; return[[NSString alloc] Initwithdata:gb2312data encoding:encoding];}
IOS Encoding Conversion