שאלת msmq

ארזירון

New member
שאלת msmq

יש לי קוד שקורא וכותב לתוך msmq. אני לא משתמש ב-formatter הקיים, אלא אני קורא וכותב ישירות לתוך ה-BodyStream, והכל עובד כמו שצריך. הבעיה קיימת לי עם עברית (איך לא?
) יש לי טקסט בתוך ה-body שהוא בעצם עברית, אבל אני לא יודע איזה עברית (unicode, utf-7, utf-8) מי שכותב את ההודעה זה מכונה של unix שמוגדרת לעבוד ב-unicode אבל אני לא מצליח להמיר את העברית שאני מקבל לשום עברית שאני יכול להציג או לשמור בקובץ. יש לי דוגמא לקריאה וכתיבה ל-msmq, ואם יש למישהו רעיונות....
Imports System.Messaging Module Module1 Sub Main() sendMessage() recMessage() End Sub Function sendMessage() As Boolean Dim mq As Messaging.MessageQueue = New Messaging.MessageQueue(".\private$\myqueue") Dim m As Messaging.Message = New Message Dim Bw As New System.IO.BinaryWriter(m.BodyStream) Bw.Write("<kuku>fufu</kuku>".ToCharArray()) mq.Send(m, "lbl") Return True End Function Function recMessage() As String Dim mq As Messaging.MessageQueue = New Messaging.MessageQueue(".\private$\myqueue") Dim m As Messaging.Message Dim Br As System.IO.BinaryReader Dim sBody As String m = mq.Receive(New TimeSpan(0, 0, 3)) Br = New System.IO.BinaryReader(m.BodyStream) sBody = Br.ReadChars(CInt(m.BodyStream.Length)) Return sBody End Function End Module​
 

gilad g

New member
נסה ככה:

Br = New System.IO.BinaryReader(m.BodyStream, Encoding.UTF8)​
ואם זה לא עובד, אז:
Br = New System.IO.BinaryReader(m.BodyStream, Encoding.Unicode)​
 

ארזירון

New member
נפתר ככה:

Br = New System.IO.BinaryReader(m.BodyStream, Encoding.GetEncoding("Windows-1255"))​
תודה
 
למעלה