Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting HTML entities such as ♣ show up as emoticons #10

Open
nnhubbard opened this issue Feb 17, 2014 · 9 comments
Open

Setting HTML entities such as ♣ show up as emoticons #10

nnhubbard opened this issue Feb 17, 2014 · 9 comments

Comments

@nnhubbard
Copy link

For some reason, when setting a text string that contains an HTML entity, it renders that as an emoticon. Such as using ♣ will show the clubs icon.

It really shouldn't do this, as a plain UITextView with an attributed string doesn't do this. So somewhere in CYRTextView is the issue I would assume.

@illyabusigin
Copy link
Owner

Hi Nic!

We don't do anything special with emoticons in CYRTextView. I ran a test with a vanilla UITextView and am seeing the same issue where the spade is converted into an emoticon when setting just the text or attributedText property. I'm not really sure how do solve this issue right now but will investigate this coming weekend.

If you find out anything please let me know :).

Illya

@nnhubbard
Copy link
Author

Hmm, I also had done a test with just a plain UITextView and I didn't see the issue. Can you post the code that produced it? One of the Apple devs would be interested in the dev forums.

@illyabusigin
Copy link
Owner

See below:

 UITextView *textView = [[UITextView alloc] initWithFrame:self.view.frame];

// Test #1
textView.text = @"Emoticon Test: ♣ \u2663"; // \u2663 is the unicode character for ♣, displays an emoticon

// Test #2
textView.attributedText = [[NSAttributedString alloc] initWithString:@"Emoticon Test 2: ♣ \u2663"]; // displays an emoticon

// Test #3
textView.attributedText = [[NSAttributedString alloc] initWithString:@"Emoticon Test 2: &clubs"]; // displays &clubs

[self.view addSubview:textView];

@nnhubbard
Copy link
Author

Well, I didn't have issues with unicode characters, just ♣ (and many others) showing an emoticon. So, not sure if this is a CYRTextView bug, or a TextKit/UIKit bug.

@LeoNatan
Copy link

Perhaps "♣" should be escaped to avoid conversion to emoticon?

@nnhubbard
Copy link
Author

Do you mean escaping HTML entities?

@LeoNatan
Copy link

Yeah, if "& clubs;" shows as an emoticon (haha, Github also shows it so), "& amp;clubs;" will show correctly.

@nnhubbard
Copy link
Author

Yeah, but you can't expect a user to do this.

@LeoNatan
Copy link

LeoNatan commented Mar 1, 2014

Perhaps it would be best to have additional methods for setting and getting escaped text.

  • (void)setText:(NSString*)text escape:(BOOL)escape;
  • (void)setAttributedText:(NSAttributedString*)attributedText escape:(BOOL)escape;
  • (NSString*)escapedText;
  • (NSAttributedString*)escapedAttributedText;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants