开发者

VB and XML Encoding (UTF-8)?

Guys...I really need your help..

I have this vb code where i will send a value typed in a textbox to 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

And the result is successful...where by I can see the message in the queue...but i'm not sure of the XML encoding...and i need to send the message in UTF-8, furthermore i can't figure out how to send those message to be UTF-8 into the Queue...

Please help..


The Encoding can be altered with the use of the encoding-class.

Dim value As Encoding

value = Encoding.UTF8

More about using that with UFT8 can be read here in the MSDN.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜