O
O
onimor2021-10-12 13:52:16
.NET
onimor, 2021-10-12 13:52:16

Why does gRPC .NET 5.0 Cyrillic fail?

gRPC backend, Blazor front end, .NET 5.0
When running on Windows and Windows docker, everything is fine.
When I deploy in the docker on VPS (ubuntu), then on the page itself the text is Russian, but what comes from gRPC becomes �����.
It’s clear that the trouble is with the encoding, but I don’t understand what exactly is wrong, the ideas have already run out.
locale in ubuntu

spoiler
LANG=ru_RU.UTF-8
LANGUAGE=
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=


locale in docker
spoiler
# locale
LANG=ru_RU.UTF-8
LANGUAGE=ru_RU:ru
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=ru_RU.UTF-8

Who had such troubles? Tell me what's wrong

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
onimor, 2021-10-20
@onimor

It's funny, but the file was actually encoded in 1251 encoding
. In my Blazor WebAssembly project, the *.razor files are UTF8, but the gRPC files are 1251, now I understand why this happens... But it's not clear why VS creates files in different encodings.
Using notepad++ I made it utf8 and everything worked.
To fix it for new files I had to make this setting
Tools > Options > Environment > Documents > Save documents as Unicode

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question