I lost % in html source when using stringWithContentsOfUrl

0
NSString *htmlSource = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString] encoding:0x80000000 + kCFStringEncodingDOSKorean error:nil];
 NSLog(htmlSource);

I get html result tag like (col width="16"/)~~~ but the real html tag is (col width="16%"/)

% character disappears. what is problem?

iphone
html
objective-c
xcode
nsstring
asked on Stack Overflow Aug 12, 2012 by 김성민 • edited Aug 28, 2018 by 김성민

1 Answer

1

The string might still contain a %; NSLog() itself gives special significance to a % sign (consider what happens if you use %@, %d, etc.).

Try doing this: NSLog(@"%@", htmlSource); that will log only an object (the string) and keep it out of the formatting argument.

answered on Stack Overflow Aug 12, 2012 by Kevin Grant

User contributions licensed under CC BY-SA 3.0