当前位置: 代码迷 >> ASP.NET >> 空格变%20,该怎么处理
  详细解决方案

空格变%20,该怎么处理

热度:3643   发布时间:2013-02-25 00:00:00.0
空格变%20
C# code
FileUpload1.Attributes.Add("onchange", @"document.getElementById('imgPhoto').src=document.getElementById('FileUpload1').value.unescape();");

在VS2005里是正常的,到了VS2008后显示出来的文件名的空格都变成了20%,请教怎么修改上面的js把%20变或空格

------解决方案--------------------------------------------------------
编码用escape(string)
解码用unescape(string)
------解决方案--------------------------------------------------------
C# code
FileUpload1.Attributes.Add("onchange", @"document.getElementById('imgPhoto').src=unescape(document.getElementById('FileUpload1').value);");
------解决方案--------------------------------------------------------
C# code
Microsoft.JScript.GlobalObject.unescape(object @string)
------解决方案--------------------------------------------------------
urlencode
urldecode
  相关解决方案