I get very strange behaviour of string.Format. I form message like this:
protected override string GetMessageText(ManualEventFact reason)
{
var messageText = string.Format("Диспетчер закрыл событие {0}(\"{1}\")",reason.EventTemplate.DisplayName, reason.Text);
return messageText;
}
The letters in beginning are in Russian. But then, in calling method, i get this string: Äèñïåò÷åð çàêðûë ñîáûòèå Тревога("Тревога на объекте с точки зрения диспетчера")
. This seems like string.Format returned non-unicode characters for the hard-coded words. How can i deal with this problem?
P.S. I also faced this in another parts of my app.
Probably the problem in in the encoding of the source file... If you are using Visual Studio, open the cs file, then go to File
->Save (your cs) As
, then near the Save
Button, click on the small arrow, Save With Encoding
, and for the Encoding
select Unicode (UTF-8 with signature) - Codepage 65001
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With