Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-09

Function to replace some chars

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys
to William Oliveira Ferreira
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 -

Reply by email

William Oliveira Ferreira
to Graeme Geldenhuys

Thanks for the hint, Graeme, I'll take a better look on it...

2012/9/8 Graeme Geldenhuys

Show quoted text 32 lines
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 &aacute; ? > 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<http://tiopf.svn.sourceforge.net/viewvc/tiopf/tiOPF2/Trunk/Options/tiXML.pas?revision=2188&view=markup> Regards, - Graeme - -- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
________________________________ William de Oliveira Ferreira -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120908/4b365b0e/attachment.html>

Reply by email

Michael Schnell
to William Oliveira Ferreira: Does somone knows some functions that replaces special chars like ? ? ? to it HTML…
William Oliveira Ferreira wrote
Does somone knows some functions that replaces special chars like ? ? ? to it HTML special chars like &aacute; ?

If we (as seemingly planned in a Delphi XE compatible way) are going to have differently encoded strings (such as UTF-8, UTF-16, UTF-32, ANSI-Code xxxx, etc), I think it would be very appropriate to also have a string type (static type and/or dynamically defined) that provides this (and more types for even more) encoding Scheme in a compatible way (with the appropriate auto-conversion if applicable).

But of course this is more am issue to be discussed over in the fpc-devel list.

-Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120910/9c85eb85/attachment.html>

Reply by email