Skip to content

Commit

Permalink
Fixes #2061 unicode bugs
Browse files Browse the repository at this point in the history
Two places where full unicode support was failing.
  • Loading branch information
Dunbaratu committed Jul 6, 2017
1 parent ceabc75 commit 1f1b803
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 2 additions & 6 deletions src/kOS/Persistence/PersistenceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static ConfigNode ToConfigNode(this HarddiskFile file, string nodeName)
{
if (SafeHouse.Config.UseCompressedPersistence)
{
node.AddValue("binary", EncodeBase64(content.String));
node.AddValue("binary", PersistenceUtilities.EncodeBase64(content.Bytes));
}
else
{
Expand All @@ -151,9 +151,5 @@ private static FileContent Decode(string input)
}
}

private static string EncodeBase64(string input)
{
return PersistenceUtilities.EncodeBase64(Encoding.ASCII.GetBytes(input));
}
}
}
}
12 changes: 8 additions & 4 deletions src/kOS/Screen/TermWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,14 @@ void ProcessKeyEvents()
Event e = Event.current;
if (e.type == EventType.KeyDown)
{
// Unity handles some keys in a particular way
// e.g. Keypad7 is mapped to 0xffb7 instead of 0x37
var c = (char)(e.character & 0x007f);

// This ugly hack is here to solve a bug with Unity mapping
// Keycodes to Unicode chars incorrectly on its Linux version:
char c;
if ((e.character & 0xff00) == 0xff00) // Only trigger on Unicode values 0xff00 through 0xffff, to avoid issue #2061
c = (char)(e.character & 0x007f); // When doing this to solve issue #206
else
c = e.character;

// command sequences
if (e.keyCode == KeyCode.C && e.control) // Ctrl+C
{
Expand Down

0 comments on commit 1f1b803

Please sign in to comment.