[webkit-dev] API in webkit to convert Unicode <--> HTML named entities?

Dan Wood dw43031apple at karelia.com
Mon Jul 21 11:15:21 PDT 2008


I've been looking for an API to convert from a unicode character to  
its named HTML entity (like "&euro;" or "&auml;") -- if it exists --  
and vice-versa.

This appears to be a pretty common need; from what I can tell there is  
some kind of home-baked solution used in:

* Sandvox from Karelia (my App)
* Coda from Panic
* UnicodeChecker from EarthlingSoft
* Flow from Extendamac
* apps from ConnectedFlow
(just the apps that I've been able to notice)


I've scanned the WebKit sources, and it looks like the logic for doing  
this conversion is embedded somewhere in HTMLTokenizer, which uses  
some generated lookups from the file HTMLEntityNames.gperf".


Is there an API that I'm not finding, so that a Cocoa application that  
links to WebKit can do a low-level conversion in either direction?

If not, is there a hack that somebody can suggest?  (And I'm going to  
request that this be exposed as an API....)


--
Dan Wood
Karelia Software — Sandvox for the Mac
http://www.karelia.com/

It is the habit of every aggressor nation to claim that it is acting  
on the defensive. — Jawaharlal Nehru


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.webkit.org/pipermail/webkit-dev/attachments/20080721/ecfead01/attachment.html 


More information about the webkit-dev mailing list