Search code examples
c#apiunicodeencodinglivelink

German character ß encoding in Livelink using C#


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.


Solution

  • 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.