Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Special Character Handler by my self


Message #1 by ulateef@a... on Tue, 27 Feb 2001 12:52:18 +0500

Well the best solution I've gone through is following





Function Encode(word)

     Dim word1, word2, xchar

     word1 = word

     xLen = Len(var1)

     xLen = xLen - 1

     QouteStart = 0

     word2 = ""

     For i = 0 To xLen

          xchar = Mid(word1, i + 1, 1)

          if asc(xchar) = 34 and QouteStart = 0 then

               word2 = word2 & chr(147)

               QouteStart = 1

          elseif asc(xchar) = 34 and QouteStart = 1 then

               word2 = word2 & chr(148)

               QouteStart = 0

          else

               word2 = word2 & xchar

          End if

     Next

     word2 = replace(Word2,chr(38),chr(201))

     word2 = replace(Word2,chr(39),chr(202))

     word2 = replace(Word2,chr(44),chr(203))

     word2 = replace(Word2,chr(130),chr(204))

     Encode = word2

End Function



Function Decode(word)

     word2 = word

     word2 = replace(Word2,chr(200),chr(34))

     word2 = replace(Word2,chr(201),chr(38))

     word2 = replace(Word2,chr(202),chr(39))

     word2 = replace(Word2,chr(203),chr(44))

     word2 = replace(Word2,chr(204),chr(130))

     Decode = word2

End Function







Umair Latif








  Return to Index