Re: [SOLVED] Re: escape special characters in HTML
Re: [SOLVED] Re: escape special characters in HTML
- Subject: Re: [SOLVED] Re: escape special characters in HTML
- From: Dominik Pich <email@hidden>
- Date: Thu, 16 Nov 2006 15:46:25 +0100
I never said I wanted to handle ONLY umlauts - I wrote e.g. and named
two examples that came to mind. Sorry if I caused confusion.
Regards,
Dominik
Am Nov 16, 2006 um 3:30 PM schrieb Sherm Pendley:
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:
< -> <
> -> >
& -> &
' -> '
" -> "
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
_______________________________________________
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