using OmniSharp.Extensions.LanguageServer.Protocol;
public static void Main()
var filePath1 = @"c:\foo bar\test#.txt";
var filePath2 = @"c:\foo%20bar\test%23.txt";
DocumentUri documentUri1 = DocumentUri.FromFileSystemPath(filePath1);
DocumentUri documentUri2 = DocumentUri.FromFileSystemPath(filePath2);
Console.WriteLine(documentUri1.Path);
Console.WriteLine(documentUri2.Path);
var uri1 = documentUri1.ToUri();
var uri2 = documentUri2.ToUri();
Console.WriteLine(uri1.OriginalString);
Console.WriteLine(uri2.OriginalString);
var uri3 = new Uri(documentUri1.ToString());
var uri4 = new Uri(documentUri2.ToString());
Console.WriteLine(uri3.OriginalString);
Console.WriteLine(uri4.OriginalString);
Console.WriteLine(uri3.LocalPath);
Console.WriteLine(uri4.LocalPath);