We have detected a weird issue under iOS 6.0 GM when the attributed string has emoji characters.
For example, if you want to convert an attributed string that contains emoji characters to HTML.
After some debugging we have found the problem in the effectiveRange calculated value:
NSDictionary *attributes = [self attributesAtIndex:index longestEffectiveRange:&effectiveRange inRange:paragraphRange];
NSString *plainSubString =[plainString substringWithRange:effectiveRange];
In iOS 6.0 GM the effectiveRange length returned is incorrect, but correct under iOS 5.1 This causes that plainSubString has a wrong value too...
Any clue about this issue? Could you replicate it? Just use an attributed string with an smiley U+1F604
Thanks in advance,
Same bug over here
I've added a test file for Emojis 22f0611. If what you say is true then the demo should hang as soon as you tap on the "Emoji Test" snippet.
I don't see a hang under the iOS 6 SDK version that came with Xcode 4.5 DP2. I'll have to test with the GM later when I get into the office.
So far I am unable to replicate the issue. My emoji test so far via EmojiTest.html has no issue.
Please tell me the code to reproduce the issue. This one works without problem:
NSString *smiley = @"\U0001F604";
NSData *data = [smiley dataUsingEncoding:NSUTF8StringEncoding];
NSAttributedString *attributedStr = [[NSAttributedString alloc] initWithHTMLData:data baseURL:nil documentAttributes:nil];
Oh, I misread, you mean you have this attributed string and you want to go back to HTML?
Still no problem if I call htmlString on the above mentioned attributedStr:
<p style="font-family:'Times New Roman';font-size:12px;">��</p>
So: works as designed...