• 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
Re: [SOLVED] Re: escape special characters in HTML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SOLVED] Re: escape special characters in HTML


  • Subject: Re: [SOLVED] Re: escape special characters in HTML
  • From: Sherm Pendley <email@hidden>
  • Date: Thu, 16 Nov 2006 09:30:56 -0500

On Nov 16, 2006, at 8:55 AM, Dominik Pich wrote:

Partly helped me.. still:
to not break the markup I use CFXMLCreateStringByEscapingEntities

That's *completely* unnecessary to correctly handle umlauts. There are only five characters that must be escaped into entities in XML:


	<  ->  &lt;
	>  ->  &gt;
	&  ->  &amp;
	'  ->  &apos;
	"  ->  &quot;

The above must be escaped because they have special meaning to XML itself.

As I saved UTF8 and NSTextView is UTF8 (as is all cocoa?) I assumed it should automaticly try to see it as UTF8 if not specified differently.

There's no guaranteed way to detect 8-bit encodings if the file lacks a Unicode Byte Order Marker (BOM). I think NSTextView defaults to interpreting unknown text as MacRoman, for compatibility's sake.


For an example of just how complicated it can get when you try to detect the encoding of a text file, have a look at the TextEdit sample in /Developers/. Even with all that, it still amounts to an educated guess. Also note that TextEdit allows a manual override in case it guesses wrong.

I included a <meta http-equiv> tag and set the charset to UTF8 now!

In XML (but not HTML), you can also specify an "encoding" attribute for any element whose contents use a different encoding than that of the enclosing document.


For both XML and HTML, when files are being served over HTTP it's preferable to configure the web server to send the correct HTTP header; if you don't, and the browser guesses wrong initially, it will have to backtrack and start parsing the document from the beginning with the correct encoding.

sherm--

Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


_______________________________________________ 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
  • Follow-Ups:
    • Re: [SOLVED] Re: escape special characters in HTML
      • From: Dominik Pich <email@hidden>
References: 
 >escape special characters in HTML (From: Dominik Pich <email@hidden>)
 >Re: escape special characters in HTML (From: Sherm Pendley <email@hidden>)
 >[SOLVED] Re: escape special characters in HTML (From: Dominik Pich <email@hidden>)

  • Prev by Date: Re: escape special characters in HTML
  • Next by Date: Re: [SOLVED] Re: escape special characters in HTML
  • Previous by thread: [SOLVED] Re: escape special characters in HTML
  • Next by thread: Re: [SOLVED] Re: escape special characters in HTML
  • Index(es):
    • Date
    • Thread