fix handling of Unicode characters in console

This commit is contained in:
Jesse Plamondon-Willard 2021-07-28 21:20:44 -04:00
parent e8ad5d0a24
commit 880cd7b8ba
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@
* Added error if the wrong SMAPI bitness is installed (e.g. 32-bit SMAPI with 64-bit game).
* Added error if some SMAPI files aren't updated correctly.
* Added `removable` option to the `world_clear` console command (thanks to bladeoflight16!).
* Fixed handling of Unicode characters in console commands.
* Fixed intermittent error if a mod fetches mod-provided APIs asynchronously.
* For mod authors:

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using StardewModdingAPI.Framework.Commands;
@ -106,6 +107,10 @@ namespace StardewModdingAPI.Framework.Logging
if (writeToConsole)
output.OnMessageIntercepted += message => this.HandleConsoleMessage(this.MonitorForGame, message);
Console.SetOut(output);
// enable Unicode handling
Console.InputEncoding = Encoding.Unicode;
Console.OutputEncoding = Encoding.Unicode;
}
/// <summary>Get a monitor instance derived from SMAPI's current settings.</summary>