summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-07-28 21:20:44 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-07-28 21:20:44 -0400
commit880cd7b8bacfcee2cc6a8e15b6b8ea5e05e9467c (patch)
tree0635a893e1d5fb86a4dcd57bcb418954e5ace2f5
parente8ad5d0a2404720ec4f8cc75117e62bcc72cd068 (diff)
downloadSMAPI-880cd7b8bacfcee2cc6a8e15b6b8ea5e05e9467c.tar.gz
SMAPI-880cd7b8bacfcee2cc6a8e15b6b8ea5e05e9467c.tar.bz2
SMAPI-880cd7b8bacfcee2cc6a8e15b6b8ea5e05e9467c.zip
fix handling of Unicode characters in console
-rw-r--r--docs/release-notes.md1
-rw-r--r--src/SMAPI/Framework/Logging/LogManager.cs5
2 files changed, 6 insertions, 0 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 782d64bb..0f144bf5 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -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:
diff --git a/src/SMAPI/Framework/Logging/LogManager.cs b/src/SMAPI/Framework/Logging/LogManager.cs
index 2cd512e0..e16b5c0d 100644
--- a/src/SMAPI/Framework/Logging/LogManager.cs
+++ b/src/SMAPI/Framework/Logging/LogManager.cs
@@ -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>