Msgbox Len(htmlcontent)vtmp = Evaluate({@URLDecode(“Domino”;“} & Left(htmlcontent,3000) & {”)},doc)
if the string htmlcontent>2000-3000 Bytes (i am not sure how long)
the @urlDecode can’t run!
and this never happened before! why
help me !
Msgbox Len(htmlcontent)vtmp = Evaluate({@URLDecode(“Domino”;“} & Left(htmlcontent,3000) & {”)},doc)
if the string htmlcontent>2000-3000 Bytes (i am not sure how long)
the @urlDecode can’t run!
and this never happened before! why
help me !
Subject: @URLDEcode can decode long strings !! help!
Han,
I have no idea why that won’t work, but if you write to me at notesdev@yahoo.com, I have a search and replace function you can use to convert your encoded string back to normal and it would look like this:
searchReplace(strHTMLContent, “%20”, " ")
Also, it can be nested as such:
searchReplace(searchReplace(strHTMLContent, “%20”, " "), “&”, “&”)
This isn’t a clean solution for what you want, but it will work in a pinch. A decent search and replace funtion should have been part of LS from the beginning.
R/s,
Charlie
Subject: RE: @URLDEcode can decode long strings !! help!
Check out this response on openntf. The gives you a decode function for lotusscript that does what @URLDecode in formula language. http://www.openntf.org/projects/codebin/codebin.nsf/0/817204BF7A0EB22388256C1B00766F58
Subject: RE: @URLDEcode can decode long strings !! help!
I can see two potential issues.
First, there may be a limit on the length of the argument to Evaluate. Even is there is no limit, it’s a mistake to insert a string into the expression the way you have done; if the string contains a \ or " character the macro language parser will drop characters or detect early termination of the string, resulting probably in a syntax error.
To use string values as a value in a macro expression, store them in a field of the document and then use a constant formula that refers to them by name, e.g.:
doc.htmlcontent = htmlcontent
vtmp = Evaluate({@URLDecode(“Domino”;htmlcontent)},doc)
In this particular case, instead of using Evaluate, you could also use a LotusScript function such as the following (from this code library):
Function unescape(Byval s$) As String
' Given a string that contains "%" codes for spaces and other punctuation, as they would appear in a URL,
' this function converts them back to the original string using the Uchr$ function.
Dim pos%, lpos%, ccod$, result$
lpos = 1
pos = Instr(s, "%")
Do Until pos = 0
' the characters up until the % are ones we can just add to the string.
If pos > lpos Then result = result & Mid$(s, lpos, pos-lpos)
ccod = Mid$(s, pos+1, 2) ' get the hex code of the character
If ccod Like "[a-fA-F0-9][a-fA-F0-9]" Then
result = result & Uchr$(Cint("&H" & ccod))
lpos = pos + 3
Else
result = result & "%"
lpos = pos + 1
End If
pos = Instr(lpos, s, "%")
Loop
unescape = result & Mid$(s, lpos)
End Function
Note: This only supports UTF-8 characters, not the international spec given in Character Model for the World Wide Web 1.0: Fundamentals. But it might serve as a starting point if you want to write your own function.