2

I'm using VB.NET to consume Sabre Web Services, primarily using SabreCommandLLSRQ to send native Sabre commands. Sending special characters without any special encoding works fine, but when I try to manipulate any response that contain the Cross of Lorraine using the Response element of SabreCommandLLSRS all of the Cross of Lorraine chars are missing if I display my string in a MsgBox or try to manipulate it.

If I push that string into my clipboard and view it in Notepad++, the characters are there but they seem to be encoded improperly - they come through as something like "‡". I'm pretty new to unicode encoding so that's all a bit above my head.

I've tried using the Replace method of String Builder to change those characters to something visible no avail - anyone have a way around this issue?

Strangely, the other special characters (e.g. "¤") seem to come through just fine.

drtrobridge
  • 419
  • 3
  • 10

3 Answers3

2

This section in Dev Studio includes references to special character hex codes: https://developer.sabre.com/docs/read/soap_apis/management/utility/Send_Sabre_Command

Does this help?

fcarreno
  • 701
  • 4
  • 8
  • That's somewhat helpful, but I'm strangely not having issues with sending the special chars, only receiving them. I don't know if VB.NET handles them differently than C# or what, but in my text responses, I'm getting the  character plus something else that I can't decipher. – drtrobridge Mar 15 '16 at 21:18
2

This is a pain in the behind due to the invisible characters.

String replace does work you just need to make sure you capture the invisible character after the Â

Simply in the SabreCommandSend function before you send the string to Sabre put something like the below.

Hopefully this should copy and paste straight out including the invisible character.

  if (tempCommand.Contains("‡"))
                        {
                            tempCommand = tempCommand.Replace("‡", "Â");
                        }
Mr Harno
  • 308
  • 1
  • 7
  • 1
    Nope the invisible character can't be copied from the above. I believe I serialised the XML output to a string and pasted it into notepad, then if you highlight the  and hold shift and click the right arrow and then ctrl-c you can copy the invisible character into a replace string. – Mr Harno Mar 10 '16 at 13:37
  • Strangely, I can send the special characters just fine - it's reading them in the responses that I'm having an issue with. If I could figure out what the actual characters are to replace I'm thinking that it might work but I can't figure out what the 2nd character is after the Â. Since I'm using the raw text response and not the XML I just can't seem to figure out how to capture and replace that particular character. – drtrobridge Mar 15 '16 at 21:15
0

I figured out how to get this to work, but its not pretty so if anyone has a better way to do it, I'm all ears.

I couldn't figure out what char to use to do the simple string Replace method, so instead I'm casting the string to a byte array, iterating through the array and replacing any strange characters I find, recasting the byte array into a raw string and doing the string replace on that:

    Imports System.Text 
Dim byteArray() As Byte = System.Text.Encoding.ASCII.GetBytes(sabreResponse)
        For i = 0 To byteArray.Length - 1
            If byteArray(i) = 63 Then 'this is a question mark char
                byteArray(i) = 94 'caret that doesn't exist in native Sabre
            End If
        Next
        MyClass.respString = System.Text.ASCIIEncoding.ASCII.GetString(byteArray)
        MyClass.respString = MyClass.respString.Replace("^", "¥")

For whatever reason, the string replace method works after I swap out the offending byte with a dummy character but not before.

drtrobridge
  • 419
  • 3
  • 10