• 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: Aandi Inston <email@hidden>
  • Date: Wed, 22 Jun 2016 18:53:06 +0100

Almost certainly not the font itself. Looks like classic mojibake. The
sequence which you seem to report, capital A circumflex, one-half might be
in the encoding ISO-8859-1 (aka Windows-1252 aka informally Latin1).

If so we have
c2 - capital A circumflex
bd - one half

But what is the UTF-8 form of one-half? It is c2bd.  So this seems the
classic case of interpreting UTF-8 as ISO-8859-1. Where that is happening
is for you to find, but my bet is that it is later than you think.

On 22 June 2016 at 17:32, tridiak <email@hidden
<javascript:_e({},'cvml','email@hidden');>> wrote:

> I am setting some text to a NSTextView which includes the ‘½’ character.
>
> s = name + “ CR "
> switch (CR) {
>         case 0.5:
>                 s=s+”½” // \u{00bd}
> ...
> 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?
_______________________________________________

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


References: 
 >unicode fraction symbol in a NSTextView (From: tridiak <email@hidden>)

  • Prev by Date: Re: unicode fraction symbol in a NSTextView
  • Next by Date: Re: OK - I must be missing something simple here.
  • Previous by thread: Re: unicode fraction symbol in a NSTextView
  • Next by thread: How to Handle Array of Dictionaries when Archiving/Unarchiving?
  • Index(es):
    • Date
    • Thread