首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

string怎样转byte()解决方法

2012-03-16 
string怎样转byte()jmail.Attachment.BinaryDatadimstream_osetstream_oServer.CreateObject( adodb.str

string怎样转byte()
jmail.Attachment.BinaryData

dim   stream_o
set   stream_o=Server.CreateObject( "adodb.stream ")
stream_o.Type   =   2   '1:adTypeBinary   ;   2:adTypeText
stream_o.Open  
'stream_o.Write   s_data
stream_o.WriteText     Attachment.BinaryData
stream_o.SaveToFile   file_name   ,   2
stream_o.Close
set   stream_o=nothing


保存后的jpg图片能用acdc打开,但不用ie和photoshop打开,说不是jpg标志,为什么那?假如用stream_o.Write   怎么实现那?就是asp中,string怎样转byte()


谢谢!


[解决办法]
Function BytesToBstr(strBody,CodeBase)
dim objStream
set objStream = Server.CreateObject( "Adodb.Stream ")
objStream.Type = 1
objStream.Mode =3
objStream.Open
objStream.Write strBody
objStream.Position = 0
objStream.Type = 2
objStream.Charset = CodeBase
BytesToBstr = objStream.ReadText
objStream.Close
set objStream = nothing
End Function


*****************************************************************************

用功譬若掘井,与其多掘数井而皆不及泉,何若老守一井,力求及泉而用之不竭乎?

[解决办法]
<%
String funcname= request.getParameter( "funcname ").trim();
byte[] tempbyte = funcname.getBytes( "ISO-8859-1 ");
//String f=null;
//f = new String(tempbyte, "gb2312 ");


%>
[解决办法]
http://community.csdn.net/Expert/topic/5669/5669972.xml?temp=.6140406

用这个贴里的BinaryToBytes转换成Byte()

热点排行