[Lazarus] Function to replace some chars

Graeme Geldenhuys graeme at geldenhuys.co.uk
Sat Sep 8 21:16:14 CEST 2012


On 08/09/12 15:39, William Oliveira Ferreira wrote:
> Does somone knows some functions that replaces special chars like ã é Ü to
> it HTML special chars like á ?

Yes, have a look in the tiOPF v2 repository on Source Forge 
(www.tiopf.com). Then in the Options/tiXML.pas unit. Take a look at the 
TtiXMLReservedCharsTranslator class. It can do the conversion in both 
directions. It already has some mapping characters setup for use with 
XML, CSV, TAB and MS-XML files, but you can easily extended that. The 
XML mapping is probably what you want, or can be adapter for HTML. I've 
cut and pasted that code and used it outside tiOPF without problems - so 
no need for a tiOPF dependency.

 
http://tiopf.svn.sourceforge.net/viewvc/tiopf/tiOPF2/Trunk/Options/tiXML.pas?revision=2188&view=markup


Regards,
   - Graeme -







More information about the Lazarus mailing list