日期:2014-05-17  浏览次数:20832 次

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()