Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 HTMLEncode, How to do?

Author  Topic 

michael1
Starting Member

28 Posts

Posted - 2004-09-20 : 02:06:54
How to perform the HTMLEncode to a string in a DTS package?

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-09-20 : 02:08:36
What are you trying to do?
Go to Top of Page

michael1
Starting Member

28 Posts

Posted - 2004-09-20 : 02:13:58

I am having a very big HTMLString which I am trying to write into a file with the help of fso, but there are some specials HTMLCharacters which are not allowing me to do so. So I am trying to Encode the HTMLString before i write it to the file.

quote:
Originally posted by timmy

What are you trying to do?


Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-09-20 : 09:15:13
In ASP there is a SERVER.HTMLencode (IIRC) function

In case its any help here's how I do URL Encode in SQL (as a function)

CREATE FUNCTION dbo.kk_FN_URLEncode
(
@strInput varchar(8000)
)
RETURNS varchar(8000)
/* WITH ENCRYPTION */
AS
/*
* kk_FN_URLEncode Encode value to be used as URL (i.e. substitute reserved characters with %nn)
*
* Returns:
*
* Encoded Content
*
* HISTORY:
*
* 19-Jun-2004 KBM Started
*/
BEGIN
IF @strInput IS NULL
BEGIN
-- Just return NULL if input string IS NULL
RETURN NULL
END
SELECT @strInput=
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
REPLACE(REPLACE(
@strInput,
CHAR(10), '%0A'),
CHAR(13), '%0D'),
' ', '%20'),
':', '%3A'),
';', '%3B'),
'-', '%2D'),
'/', '%2F'),
'\', '%5C'),
'!', '%21'),
'"', '%22'),
'#', '%23'),
'?', '%3F'),
'=', '%3D'),
'@', '%40'),
'%', '%25'),
'>', '%3E'),
'<', '%3C'),
'$', '%24'),
'&', '%26'),
'[', '%5B'),
']', '%5D'),
'~', '%7E'),
'^', '%5E'),
'`', '%60'),
'{', '%7B'),
'}', '%7D'),
'|', '%7C')
RETURN @strInput
END

Kristen
Go to Top of Page
   

- Advertisement -