VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   6810
   ClientLeft      =   120
   ClientTop       =   450
   ClientWidth     =   14985
   LinkTopic       =   "Form1"
   ScaleHeight     =   6810
   ScaleWidth      =   14985
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   1215
      Left            =   5640
      TabIndex        =   2
      Top             =   3720
      Width           =   2175
   End
   Begin VB.TextBox Text2 
      Height          =   1575
      Left            =   6600
      TabIndex        =   1
      Text            =   "Text2"
      Top             =   1200
      Width           =   6255
   End
   Begin VB.TextBox Text1 
      Height          =   1215
      Left            =   2040
      TabIndex        =   0
      Text            =   "超级少女"
      Top             =   1320
      Width           =   3615
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Text2.Text = UTF8EncodeURI(Text1.Text)
End Sub

Function UTF8EncodeURI(strUTF8 As String) As String
    Dim nFor    As Long
    Dim nAsc    As Long
    Dim strWchar    As String
    Dim strURIchar  As String
    
    UTF8EncodeURI = ""
    For nFor = 1 To Len(strUTF8)
        strWchar = Mid(strUTF8, nFor, 1)
        nAsc = AscW(strWchar)
        If nAsc < 0 Then nAsc = nAsc + 65536
        If (nAsc And &HFF80) = 0 Then
            UTF8EncodeURI = UTF8EncodeURI & strWchar
        ElseIf (nAsc And &HF000) = 0 Then
            strURIchar = "%" & Hex(((nAsc \ 2 ^ 6)) Or &HC0) & Hex(nAsc And &H3F Or &H80)
            UTF8EncodeURI = UTF8EncodeURI & strURIchar
        Else
            strURIchar = "%" & Hex((nAsc \ 2 ^ 12) Or &HE0) & _
                         "%" & Hex((nAsc \ 2 ^ 6) And &H3F Or &H80) & _
                         "%" & Hex(nAsc And &H3F Or &H80)
            UTF8EncodeURI = UTF8EncodeURI & strURIchar
        End If
    Next
End Function

