Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Bug with emoji and iOS 6 GM #219

Closed
frankai opened this Issue · 6 comments

3 participants

@frankai

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,

Frankai

@FredericJacobs

Same bug over here

@Cocoanetics
Owner

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.

@Cocoanetics
Owner

So far I am unable to replicate the issue. My emoji test so far via EmojiTest.html has no issue.

@Cocoanetics
Owner

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];
NSLog(@"%@", attributedStr);
@Cocoanetics
Owner

Oh, I misread, you mean you have this attributed string and you want to go back to HTML?

@Cocoanetics
Owner

Still no problem if I call htmlString on the above mentioned attributedStr:

<p style="font-family:'Times New Roman';font-size:12px;">&#55357;&#56836;</p>

So: works as designed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.