Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lsp4e-dev] Character encoding of requests?

Hi Mickael,

Ugh... it was my fault after all :-(   I think the clue was that vscode and lsp4e were both behaving the same way, and yet looking at the lsp4j code, it is exactly as it should be.

I was processing the bytes, but I was reading them from a Reader rather than the raw Stream, so they had already been decoded into UTF8. It happens that the Unicode codepoint for a decoded pound is the same as the cp1252 byte encoding, so the bytes "double decoded" correctly as cp1252, though the length would then be wrong. And the length was correct for UTF8, because... they are correctly sending UTF8.

So I'm sorry for the confusion, but many thanks for listening! :-)

Cheers,
-nick


On Fri, 10 Apr 2020 at 22:17, Mickael Istria <mistria@xxxxxxxxxx> wrote:


On Fri, Apr 10, 2020 at 10:43 PM Nick Battle <nick.battle@xxxxxxxxx> wrote:
Yes, the language engine chokes on the bad decoding.  So if I decode the byte array as cp1252, I get a (Java) pound character and all is well; if I decode as UTF8 (which is my default, but it's the same if I'm explicit) then I get a "<?>" character - basically an unknown decoding. As cp1252, the character appears in the logs as expected and so on; as utf8, it's always nonsense. So I'm pretty sure it's cp1252 encoded, and of course I can see the single byte value of A3 (or -93 as a Java byte), whereas a UTF8 pound would be a pair: C2 A3. Technically I think it could be ISO-8859-1, but I'd need to try more experiments to tell.

OK, interesting case...

And it's the same with vscode and lsp4e.  It occurred to me that this is probably lsp4j underneath, though I don't know whether vscode uses that?

For the client part, VSCode uses the vscode-languageserver node module. No relationship with LSP4J.
But some language servers used in VSCode plugins (including the Java language server, or more generally all language servers written in Java) do use LSP4J.
_______________________________________________
lsp4e-dev mailing list
lsp4e-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/lsp4e-dev

Back to the top