2010-01-27 43 views
0

傢伙...我真的需要你的幫助..VB和XML編碼(UTF-8)?

我有這樣的VB代碼,我將發送一個文本框中鍵入MSMQ值...

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click 
    Dim mq As MessageQueue 
    'Dim format As XmlMessageFormatter 
    Dim msg As Message 
    'Dim dec As XmlDeclaration 

    Try 
     msg = New Message 
     msg.Priority = MessagePriority.Normal 

     If Not (MessageQueue.Exists(".\Private$\toNavision")) Then 
      mq = MessageQueue.Create(".\Private$\toNavision") 

     Else 
      mq = New MessageQueue(".\Private$\toNavision") 

     End If 
     msg.Label = "Navision MSMQ-BA" 
     msg.Body = TextBox1.Text 

     mq.Send(msg) 
     Label1.Text = "Message sent." 

    Catch ex As MessageQueueException 
     Label1.Text = ("MSMQ Error: " + ex.ToString()) 

    Catch ex As Exception 
     Label2.Text = ("Error: " + ex.ToString()) 

    Finally 
     mq.Close() 

    End Try 

End Sub 

,結果是成功的。 ..我可以看到隊列中的消息...但我不確定XML編碼...我需要以UTF-8發送消息,此外我無法弄清楚如何發送那些消息是UTF-8進入隊列...

請幫忙..

回答

0

T他可以使用編碼類來修改Encoding。

Dim value As Encoding 

value = Encoding.UTF8 

更多關於使用與UFT8可以讀取在MSDNhere