3

I have folder name that contains German special character such äÄéöÖüß.The following screenshot display contents of LiveLink server.

enter image description here

I want to extract folder from Livelink server using C#.

valueis obtained from LLserver.

  var bytes = new List<byte>(value.Length);           

         foreach (var c in value)
         {
             bytes.Add((byte)c);                 
         }           

        var result = Encoding.UTF8.GetString(bytes.ToArray());

Finally, the result is äÄéöÖü�x .where ß is seen as box character '�x'. All other characters present in folder name are decoded successfully/properly except the ß character.

I am just wondering why the same code works for all other German special characters but not for ß.

Could anybody help to fix this problem in C#?

Thanks in advance.

  • What is "LLServer" ? What type of array is `value` ? – Eduard Dumitru Sep 18 '13 at 09:41
  • LLServer is LiveLink Server, which is also known Content Server. –  Sep 18 '13 at 09:54
  • And what type of array is `value` ? Is it `int[] value` ? Or what is it ? – Eduard Dumitru Sep 18 '13 at 09:57
  • value is a c# string, which is obtained from LiveLink API com.opentext.api.LLValue. –  Sep 18 '13 at 10:04
  • The symbol “�” indicates character-level data error, in this case some bytes that do not even formally conform to the definition of the UTF-8 format. Can you show what the raw data, as numeric values of bytes, is here? (I suspected that the offending character is not really the common “ß” but its rare uppercase equivalent “ẞ”, but this shouldn’t be a problem in UTF-8.) – Jukka K. Korpela Sep 18 '13 at 10:07
  • The byte value of ẞ is 223 –  Sep 18 '13 at 10:16
  • Which version of Livelink or Content Server are working with? There is a patch for version 9.7.1 available. – Steffen Roller Sep 18 '13 at 21:32
  • Livelink server Version: 10.0.0 Update Number: 10 Build Number: 21 –  Sep 19 '13 at 04:14
  • This is issue is due to Livelink server encoding. I changed the encoding method to UTF-8 and it works fine. –  Sep 22 '13 at 06:55

2 Answers2

1

Go to admin panel of server Livelink/livelink.exe?func=admin.sysvars and set Character Set: UTF-8

and code section change as follow

        byte[] bytes = Encoding.Default.GetBytes(value); 
        var retValue = Encoding.UTF8.GetString(bytes);

It works fine.

Shyam sundar shah
  • 2,473
  • 1
  • 25
  • 40
0

You guessed your encoding to be UTF8 and it obviously is not. You will need to find out what encoding the byte stream really represents and use that instead. We cannot help you with that, you will have to ask the sender of said bytes.

nvoigt
  • 75,013
  • 26
  • 93
  • 142