• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
unicode fraction symbol in a NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

unicode fraction symbol in a NSTextView


  • Subject: unicode fraction symbol in a NSTextView
  • From: tridiak <email@hidden>
  • Date: Thu, 23 Jun 2016 04:32:01 +1200

I am setting some text to a NSTextView which includes the ‘½’ character.

s = name + “ CR "
switch (CR) {
	case 0.5:
		s=s+”½” // \u{00bd}
	case 0.33:
		s=s+"⅓"
	case 0.25:
		s=s+"¼"
	case 0.2:
		s=s+"⅕"
	case 0.17:
		s=s+"⅙"
	case 0.14:
		s=s+"⅐"
	case 0.13:
		s=s+"⅛"
	default:
		if CR<1 {s=s+String(format:"%.1f", CR)}
		else {s=s+String(format:"%.0f", CR)}
	}
s=s+"\n”

let d : NSData = s.dataUsingEncoding(NSUTF8StringEncoding)!
let ats : NSMutableAttributedString = NSMutableAttributedString(HTML: d, documentAttributes: nil)!
self.blab.textStorage?.setAttributedString(ats)


What I see is 'Aasimar CR ½’ instead of 'Aasimar CR ½’.
Where is the ‘Â' coming from?
Is it the font or some swift-obj-C confusion?

TIA

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • unicode fraction symbol in a NSTextView
      • From: Aandi Inston <email@hidden>
    • Re: unicode fraction symbol in a NSTextView
      • From: Steve Christensen <email@hidden>
    • Re: unicode fraction symbol in a NSTextView
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: OK - I must be missing something simple here.
  • Next by Date: Re: unicode fraction symbol in a NSTextView
  • Previous by thread: Re: OK - I must be missing something simple here.
  • Next by thread: Re: unicode fraction symbol in a NSTextView
  • Index(es):
    • Date
    • Thread