I needed to encode character to &#xxxxx;
format such as Chinese Characters, I would like to convert a chinese character to a '&#xxxxx;' format.
I want:
a Character -> "中"
.....
anyone could help me with?? many many many thanks!!
I needed to encode character to &#xxxxx;
format such as Chinese Characters, I would like to convert a chinese character to a '&#xxxxx;' format.
I want:
a Character -> "中"
.....
anyone could help me with?? many many many thanks!!
You can try using this NSString+HTML category by Michael Waterfall.
You'll need to:
NSString+HTML.h
, NSString+HTML.m
, GTMNSString+HTML.h
, and GTMNSString+HTML.m
into your project.m
files and add -fno-objc-arc
under their Compiler Flags#import "NSString+HTML.h"
Use as so:
[chineseString stringByEncodingHTMLEntities]