How to disable NSTextView's HTML rendering?
How to disable NSTextView's HTML rendering?
- Subject: How to disable NSTextView's HTML rendering?
- From: "John C. Daub" <email@hidden>
- Date: Sat, 08 Jan 2005 14:58:45 -0600
Hello.
My application is given a "text file", I read it into an NSAttributedString,
then set the NSTextView's NSTextStorage to the NSAttributedString. This
works out fine to have the NSTextView display the contents of the "text
file". I say "text file" because I know it's some sort of text, as opposed
to a graphics or movie or MS Word or general binary data file. But I don't
know exactly what the contents of the file is... could be 7-bit ASCII, could
be an old-school SimpleText file (i.e. text with a 'styl' resource), could
be HTML, could be XML, a plist file, etc.. While I can take hints about the
file type (and contents) from the filename extension and/or OSType filetype,
I cannot rely upon this as that information may be inaccurate or not
present. Yet I still need to do my best to display the file nicely (it's a
previewing mechanism).
Yesterday my teammate was working with our app, and he ended up selecting a
file that contained HTML code. Apparently there was something in that HTML
that, when NSTextView rendered it, initiated a network connection because
Network SpyAlert (part of Internet Cleanup, blocks unwanted network
connections such as those from "phone-home" type spyware) came up saying
that our app was trying to initiate a network connection! We do not want
that sort of thing. :-)
We do think that the HTML rendering is nifty and would like to keep it
around as it's a lot more meaningful for our needs (previewing). However, we
don't need side-effects like network connections being initiated. Is there
any way to disable this and keep this from happening (the network
connection)? I didn't see anything in docs nor mailing list archives nor
Google, but I may not have chosen the proper keywords. ;-)
I don't know how NSTextView determines "this file is an HTML file" and thus
displays the file contents as rendered HTML instead of raw file contents.
But I'm wondering if there's a way to disable this or override it, so you
feed it a .html file and it just shows the raw HTML? I mean, I know I could
always read the file into an NSString instead of an NSAttributedString and
that would take care of it, but that would affect all files read in, and I'd
still like SimpleText files to render with their styles. So if the network
issue cannot be directly addressed, if there was some way to tell NSText to
not render HTML and instead just show the raw file contents, that'd work
too.
Thanx for the help.
--
John C. Daub }:-)>=
<mailto:email@hidden> <http://www.hsoi.com/>
Peace on the Earth, goodwill to men.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden