• 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
Cocoa text services handling of malformed Unicode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cocoa text services handling of malformed Unicode


  • Subject: Cocoa text services handling of malformed Unicode
  • From: John Scalo <email@hidden>
  • Date: Mon, 27 Jan 2003 22:52:53 -0800

Hi,

I have a web URL that contains UTF-8 data. Normally, this data is accepted
without problems by a call such as

dataStr = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];

but recently this same call started returning nil. My guess is that an
invalid combination of bytes appeared on that page and Cocoa text services
now bails on it. I've tried other encodings but either get garbage or nil.
Adding a <http-equiv="Content-Type" content="text/html; charset=utf-8"> meta
tag doesn't help.

Questions-
Does Cocoa really bail on encoding a huge amount of data which only contains
a few "bad" bytes? Seems it would be more helpful to at least make a guess.

I manage this page, but the data is dynamic (it's a php script that formats
high scores from a SQL database). Is there some way that I can determine
which string is "bad", assuming that's the case, so I can remove it (and
only it)?

A Cocoa web browser displays the string encoded data ok. Assuming it's using
Cocoa, why is it successful when my code fails?

For the curious, the page is
http://lumacode.com/simon/simon_formatted_top100.php?vers=1100

(this is for the game Simon Extreme, http://lumacode.com/simon, source code
available)

Thanks
John
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Cocoa text services handling of malformed Unicode
      • From: Aki Inoue <email@hidden>
  • Prev by Date: Re: NSDrawer delegate function mis-described?
  • Next by Date: nscolumn title redrawing
  • Previous by thread: Re: Setting the Default Browser?
  • Next by thread: Re: Cocoa text services handling of malformed Unicode
  • Index(es):
    • Date
    • Thread