Question

I want to extract file/folder and other item type that contains some German special characters in their name from Livelink server. Livelink server has encoding UTF-8. Value is Test Dokument äöüß

      var bytes = new List<byte>(value.Length);
        foreach (var c in value)
            bytes.Add((byte)c);
        var retValue = Encoding.UTF8.GetString(bytes.ToArray());

the above code sample fixes s encoding problem in some character but ß is seen as ? character in Latin( ISO 8859-2) encoding. can anybody help me fix the problem.

Thanks in advance

No correct solution

OTHER TIPS

You have to set UTF-8 encoding on the LL session:

LLSTATUS llSessionStatus = LL_SessionAllocEx( &llSession, server, port,  "",  login, password, NULL);
LLSTATUS status = LL_SetCodePage( llSession , LL_TRUE, LL_TRUE, (LLLONG) 65001 );

65001 - is the codepage for UTF-8

It doesn't make sense to store ISO-8859-1 in a C# string, since it stores Unicode characters.

What really makes sense is to convert the Unicode string into a byte[] representing the string in ISO-8859-1.

var test ="äöüßÄÖÜ";
var iso = Encoding.GetEncoding("ISO-8859-1");
var bytes = iso.GetBytes(test);
File.WriteAllBytes("Sample file ISO-8859-1.txt", bytes);

Try this and you'll see that the text file is correctly encoded.

You can even check with a hex editor or with the debugger that the ß is correctly encoded as 0xDF (see table on wikipedia)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top