Chức năng: Chuyển đổi nội dung nhị phân sang dạng String
Ngôn ngữ: asp - Nhóm: string
CÚ PHÁP
strText = BinaryToString(byVal Binary)
Chuyển đổi giá trị đối số Binary về dạng String.
VÍ DỤ
<%
Dim a
a = BinaryToString(Binary)
%>
ASP Code
<%
Function BinaryToString(byVal Binary, byVal CharSet)
'--- Converts the binary content to text
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
'--- Specify stream type.
BinaryStream.Type = 1 '--- adTypeBinary
'--- Open the stream And write text/string data To the object
BinaryStream.Open
BinaryStream.Write strContent
'--- Change stream type To binary
BinaryStream.Position = 0
BinaryStream.Type = 2 '--- adTypeText
'--- Specify charset for the source text (unicode) data.
BinaryStream.CharSet = "UTF-8"
'--- Open the stream And get binary data from the object
strText = BinaryStream.ReadText
End Function
%>