Skip to content

LSP: could we use utf-8 without BOM when -lsp --encoding utf-8 is specified? #2691

@ntdiary

Description

@ntdiary
  1. when I launch lsp server with --encoding utf-8 and then send a request, server writes BOM to stdout first:
    Image
    because Encoding.GetEncoding("utf-8") gets utf-8 encoding with BOM

    var encoding = Encoding.GetEncoding(application.Encoding);
    Console.InputEncoding = encoding;
    Console.OutputEncoding = encoding;

  2. If --encoding utf-8 is not specified and my system's default encoding is also utf-8, the server does not write a BOM to stdout.

Considering that LSP currently only supports utf-8, I'm curious if it's possible to ensure the server consistently use utf-8 without BOM across all platforms (just for lsp case). This would make client-side parsing slightly simpler. BTW, neovim has removed the logic for filtering out BOM in lsp client, so it will throw an error when receiving the message with BOM.

💖

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions