views:

126

answers:

1

I'm trying to send HL7 messages to a receiver. The receiver now says they got question marks instead of 'ä' and 'ö'. What should I do?

Right now I do it about like this:

I initialize System.Net.Sockets.TcpClient and then

Dim data(payload.Length) As Byte
Dim stream As System.Net.Sockets.NetworkStream = _tcpClient.GetStream()
System.Text.Encoding.ASCII.GetBytes(payload).CopyTo(data, 1)
stream.Write(data, 0, data.Length)

Payload is my message of type string including characters like 'ä' and 'ö'.

I'm using Visual Studio 2003 and framework 1.1.

+2  A: 

I don't know about HL7, but basically your problem is that you're using ASCII.

What encoding does HL7 allow? If it lets you use UTF-8, that's probably the easiest fix - just change your use of Encoding.ASCII to Encoding.UTF8.

Jon Skeet