iOS to request WebService, for convenience, directly with the HTTP POST request. Through the Java version of the capture discovery, the request in the Chinese characters, are converted to Unicode encoding.
Such as: A is changed to & #97;
"Actually very simple, get the corresponding number of each character, such as 999,unicode encoding is:& #999; 】
In order to implement the relevant functions, the string is manually spliced, the code is as follows:
-(NSString *) Convert2unicode: (NSString *) str{nsmutablestring*resultstring =[[Nsmutablestring alloc]init]; Nsinteger length=[str length]; for(intI=0; i<length; i++) { //NSLog (@ "convertstring2unicode ****** charatindex%d is%c code:&#%d;", I,[str characteratindex:i],[str CHARACTERATINDEX:I]);[Resultstring appendstring:[nsstring stringWithFormat:@"&#%d;", [str characteratindex:i]]; } returnresultstring;}
I did not test the effect of the direct string, welcome to the guidance.
Implementation of content Unicode encoding when IOS simulates SOAP request WebService using HTTP