Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Server.HTMLEncode equivalent for VFP?
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00456699
Message ID:
00456768
Views:
26
Well, that doesn't work to post here because the entity references get translated actually. You might want to look at the HTML source for
the previous message to see what was posted originally. You may also
need to encode the & character for this reason (& amp with no space)

+++ Rick ---

>>


>>Can anbody recommend how to use Server.HTMLEncode for IIS (assuming either IIS or PWS is installed on the same PC) from within VFP, or otherwise get the equivalent functionality of Server.HTMLEncode from within VFP? In other words, I need a text-to-HTML encoding function that translates ">" and "<" and other special characters to the appropriate > and < syntax. Thanks.
>>

>
>I usually use two functions for this (mainly for displaying HTML and code
>in an HTML document):
>
>
>************************************************************************
>Function FixHTMLForDisplay
>************************************************************************
>#IF .F.
>*:Help Documentation
>*:Topic:
>wwUtils::FixHTMLForDisplay
>
>*:Description:
>This method fixes up HTML for display. Takes HTML and XML tags and converts
>them to HTML displayable characters (< for < for example).
>
>*:Parameters:
><>lcHTML<>
>HTML to fix up.
>
>*:Returns:
>Fixed up HTML
>*:ENDHELP
>#ENDIF
>************************************************************************
>LPARAMETER lcHTML
>
>lcHTML = STRTRAN(lcHTML,"<","<")
>lcHTML = STRTRAN(lcHTML,">",">")
>lcHTML = STRTRAN(lcHTML,["],""")
>
>RETURN lcHTML
>
>
>************************************************************************
>FUNCTION DisplayMemo
>**************************
>*** Function: Fixes linebreaks into HTML breaks
and


>*** Pass: lcHTML - HTML to fix
>*** Return: Fixed HTML
>*************************************************************************
>LPARAMETER lcHTML
>
>lcHTML = STRTRAN(lcHTML,CHR(13)+CHR(10),CHR(13))
>lcHTML = STRTRAN(lcHTML,CHR(10),CHR(13))
>lcHTML = STRTRAN(lcHTML,CHR(13)+CHR(13),"

")
>
>RETURN STRTRAN(lcHTML,CHR(13),"
")
>* FixHTMLLineBreaks
>

+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform