我在数据库中有文字,没有'/ r / n'。但是当分配这个文本i文本区域输入控件时,它会在文本区域中生成下一行(beak)。
请让我知道它在文本中找到的“返回进位”并在文本中添加“/ r / n”。
第一次'/ r / n'不是在文本中,在放入文本区域之前,但是在将其放入“文本区域”n保存之后,它用'/ r / n'保存文本。
答案 0 :(得分:0)
当我将文本/字符串写入数据库时,我通过clean()函数运行它。当我将文本/字符串拉出数据库以显示时,我通过dirty()运行它们。我将这两个文件保存为包含文件为" i_fn_clean.asp"和" i_fun_dirty.asp"。他们在这里:
function clean(FixWhat)
if (isempty(FixWhat) or isnull(FixWhat) or FixWhat="") then
FixWhat=""
else
apos=chr(39)
quot=chr(34)
FixWhat=trim(FixWhat)
FixWhat=replace(FixWhat," "," ",1,-1,1)
FixWhat=replace(FixWhat,"''",apos & apos,1,-1,1)
FixWhat=replace(FixWhat,"'''",apos,1,-1,1)
FixWhat=replace(FixWhat,VBNullChar,"",1,-1,1)
FixWhat=replace(FixWhat,VBNullString,"",1,-1,1)
FixWhat=replace(FixWhat,VBTab," ",1,-1,1)
FixWhat=replace(FixWhat,VBVerticalTab," ",1,-1,1)
FixWhat=replace(FixWhat,"&","&",1,-1,1)
FixWhat=replace(FixWhat,"amp;","&",1,-1,1)
FixWhat=replace(FixWhat,"&","&",1,-1,1)
FixWhat=replace(FixWhat,"&&","&",1,-1,1)
FixWhat=replace(FixWhat,"&&","&",1,-1,1)
FixWhat=replace(FixWhat,"<","<",1,-1,1)
FixWhat=replace(FixWhat,">",">",1,-1,1)
FixWhat=replace(FixWhat,"/","/",1,-1,1)
FixWhat=replace(FixWhat,"’",apos,1,-1,1)
FixWhat=replace(FixWhat,"’",apos,1,-1,1)
FixWhat=replace(FixWhat,"`",apos,1,-1,1)
'FixWhat=replace(FixWhat,chr(145),apos,1,-1,1)
'FixWhat=replace(FixWhat,chr(146),apos,1,-1,1)
'FixWhat=replace(FixWhat,chr(180),apos,1,-1,1)
'FixWhat=replace(FixWhat,chr(184),apos,1,-1,1)
'quotes
'FixWhat=replace(FixWhat,chr(132),quot,1,-1,1)
'FixWhat=replace(FixWhat,chr(147),quot,1,-1,1)
'FixWhat=replace(FixWhat,chr(148),quot,1,-1,1)
'FixWhat=replace(FixWhat,chr(152),quot,1,-1,1)
'FixWhat=replace(FixWhat,chr(168),quot,1,-1,1)
'hyphens
'FixWhat=replace(FixWhat,chr(150),"-",1,-1,1)
'FixWhat=replace(FixWhat,chr(151),"--",1,-1,1)
'dot dot dot
'FixWhat=replace(FixWhat,chr(133),"...",1,-1,1)
FixWhat=replace(FixWhat,vbCrLf & vbCrLf,vbCrLf,1,-1,1)
FixWhat=replace(FixWhat,"[quote]",""",1,-1,1)
FixWhat=replace(FixWhat,quot,""",1,-1,1)
FixWhat=replace(FixWhat,"'","'",1,-1,1)
end if
clean=FixWhat
End Function
Function dirty(FixWhat)
if (isnull(FixWhat) or FixWhat="") then
FixWhat=""
else
FixWhat=trim(FixWhat)
FixWhat=replace(FixWhat," "," ",1,-1,1)
FixWhat=replace(FixWhat,"’","'",1,-1,1)
FixWhat=replace(FixWhat,"'","'",1,-1,1)
FixWhat=replace(FixWhat,"%27","'",1,-1,1)
FixWhat=replace(FixWhat,"'","'",1,-1,1)
FixWhat=replace(FixWhat,"’","'",1,-1,1)
FixWhat=replace(FixWhat,"/","/",1,-1,1)
FixWhat=replace(FixWhat,"''''","'''",1,-1,1)
FixWhat=replace(FixWhat,""",chr(34),1,-1,1)
FixWhat=replace(FixWhat,"%22",chr(34),1,-1,1)
FixWhat=replace(FixWhat,chr(13) & chr(10),"",1,-1,1)
FixWhat=replace(FixWhat,"&","&",1,-1,1)
FixWhat=replace(FixWhat,"amp;","&",1,-1,1)
FixWhat=replace(FixWhat,"&","&",1,-1,1)
FixWhat=replace(FixWhat,"&&","&",1,-1,1)
FixWhat=replace(FixWhat,"&&","&",1,-1,1)
FixWhat=replace(FixWhat,"<","<",1,-1,1)
FixWhat=replace(FixWhat,">",">",1,-1,1)
'FixWhat=replace(FixWhat,"&","&",1,-1,1)
end if
dirty=FixWhat
End Function