再问文本框中内容提交到数据库,文字格式保持不变的问题

storein 2003-08-19 05:23:23
将文本框中内容提交到数据库,为了保持文字的格式不变化,
大家都告诉我说使用一个函数替换掉一些特殊字符,然后
将替换后的内容存入数据库中,这样重新从数据库中提取
显示时,正常.可是当重新编辑内容时,却出现了一些本来没有的
字符,再次提交的话,会出来更多的字符.
对这种还会编辑内容的问题,大家怎么处理?如何避免出来
替换的字符,谢谢.
...全文
51 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
storein 2003-08-19
  • 打赏
  • 举报
回复
diya(风火浪):
你说的有道理
coffee_cn 2003-08-19
  • 打赏
  • 举报
回复
function htmlencode2(str) '转化字符串

if isNULL(str) then
htmlencode2=""
exit function
end if

dim result
result=str

result=replace(result,chr(13),"<br>")
result=replace(result," ",chr(9))
result=replace (result,chr(9),"  ")

htmlencode2=result
end function
diya 2003-08-19
  • 打赏
  • 举报
回复
在把数据录入库时并不需要替换掉如“换行,空格,<,>”之类的特殊字符,这些字符只在数据显示时对其进行替换即可。
coffee_cn 2003-08-19
  • 打赏
  • 举报
回复
function htmlencode2(str) '转化字符串

if isNULL(str) then
htmlencode2=""
exit function
end if

dim result
result=str

result=replace(result,chr(13),"<br>")
result=replace(result," ",chr(9))
result=replace (result,chr(9),"  ")

htmlencode2=result
end function

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧