Skip navigation.
 
mlRe: Encoding a string for HTML
FROM : Peter Bierman
DATE : Thu Jul 20 20:41:45 2006

At 10:18 AM -0700 7/20/06, David Dunham wrote:
>On 20 Jul 2006, at 09:36, Douglas Davidson wrote:
>

>>>I'm trying to output a string suitable for using in HTML -- no
>>>troublesome characters like < and >.

>

>>Using NSAttributedString's HTML generation should work, although
>>it's a bit heavyweight if you don't actually want any markup.

>
>So there's no lightweight way to do it? (Other than rolling my own
>list of entities, which seems like reinventing the wheel.)



You can use
CFXMLCreateStringByEscapingEntities()
Given a CFString object containing XML source, returns a CFString
object with the specified XML entities escaped. The standard XML
entities are always replaced.


http://developer.apple.com/documentation/CoreFoundation/Reference/CFXMLTreeRef/Reference/reference.html

-pmb

Related mailsAuthorDate
mlEncoding a string for HTML David Dunham Jul 20, 06:25
mlRe: Encoding a string for HTML Douglas Davidson Jul 20, 18:36
mlRe: Encoding a string for HTML David Dunham Jul 20, 19:18
mlRe: Encoding a string for HTML Douglas Davidson Jul 20, 20:12
mlRe: Encoding a string for HTML Peter Bierman Jul 20, 20:41
mlRe: Encoding a string for HTML Norman Gray Jul 21, 00:13
mlRe: Encoding a string for HTML David Dunham Jul 21, 00:26
mlRe: Encoding a string for HTML Norman Gray Jul 21, 11:40