1樓:張晏廉晨璐
跟你text1.text設定的語言有關係,你文字中儲存的阿拉伯語,那麼text1.text設定的語言也要是阿拉伯語
2樓:匿名使用者
private declare function icepub_gbktoutf8 lib "icepubdll.dll" (byval strgbkinfo as string,byval strutf8info as string,byval strmaxlen as integer) as integer
dim str1 as string
dim a2 as integer
str1=space(1024+1)
a2=icepub_gbktoutf8("月光",str1,128)msgbox str1
vb中如何將字串轉換為utf-8編碼?
3樓:
private declare function multibytetowidechar lib "kernel32" (byval codepage as long, byval dwflags as long, byval lpmultibytestr as long, byval cchmultibyte as long, byval lpwidecharstr as long, byval cchwidechar as long) as long
private declare function widechartomultibyte lib "kernel32" (byval codepage as long, byval dwflags as long, byval lpwidecharstr as long, byval cchwidechar as long, byval lpmultibytestr as long, byval cchmultibyte as long, byval lpdefaultchar as long, byval lpuseddefaultchar as long) as long
private const cp_acp = 0 ' default to ansi code page
private const cp_utf8 = 65001 ' default to utf-8 code page
private sub command1_click()
dim s as string, a() as byte
s = text1.text
a = encodetobytes(s)
for i = 0 to ubound(a)
text2.text = text2.text & hex(a(i)) & " "
next
end sub
public function encodetobytes(byval sdata as string) as byte()
dim aretn() as byte, nsize as long
nsize = widechartomultibyte(cp_utf8, 0, strptr(sdata), -1, 0, 0, 0, 0)
redim aretn(0 to nsize - 1) as byte
widechartomultibyte cp_utf8, 0, strptr(sdata), -1, varptr(aretn(0)), nsize, 0, 0
encodetobytes = aretn
end function
4樓:匿名使用者
vb裡漢字就是一個字元
msgbox (len("漢字"))這句顯示為2
vb怎麼把ansi編碼的txt檔案轉為utf-8編碼? 100
5樓:匿名使用者
charset設定為utf-8即可
function bytestobstr(body, charset)
dim objstream
set objstream = createobject("adodb.stream")
objstream.type = 1
objstream.mode = 3
objstream.open
on error resume next
objstream.write body
objstream.position = 0objstream.type = 2
objstream.charset = charsetbytestobstr = objstream.readtextobjstream.close
set objstream = nothingend function
6樓:章貢物語
0122444444
如何在vb裡進行日期格式轉換,如何在VB裡進行日期格式轉換
這裡的要點是設定返回值的型別為字串型別。private sub command1 click s1 20130924200000 dim s as string s format a,0000 00 00 00 00 00 print s end sub 如果取得資料比較規則那麼用下面的就行 new...
vb如何讀取中內容,vb如何讀取txt中內容
用api函式獲得使用者資料夾,這個我不曉得,我只會用獲取的使用者名稱來做.下面的 我並沒有限制使用者桌面上的txt檔案必須為 新建 文字文件.txt 也就是滿足檔案裡有字串 1234 的txt檔案,就刪除。你可以自己調整一下,這樣就不需要filelistbox控制元件了,如果只是針對你自己的電腦,這...
VB中如何統計輸入的數字的個數,VB中如何統計輸入的數字的個數
1 啟動vb新建工程1,在form1的合適位置畫出3個label框 2個text框以及1個command按鈕 可以預先對各控制元件的caption等屬性進行修改 2 雙擊 統計 即command1 按鈕,在彈出的 框中編寫如下 privatesubcommand1 click dimxasstrin...