diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
index 5d328e106cc..4580d02b9b5 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
@@ -401,6 +401,35 @@ namespace Godot
return instance.Substring(sep + 1);
}
+ ///
+ /// Converts the given byte array of ASCII encoded text to a string.
+ /// Faster alternative to if the
+ /// content is ASCII-only. Unlike the UTF-8 function this function
+ /// maps every byte to a character in the array. Multibyte sequences
+ /// will not be interpreted correctly. For parsing user input always
+ /// use .
+ ///
+ /// A byte array of ASCII characters (on the range of 0-127).
+ /// A string created from the bytes.
+ public static string GetStringFromASCII(this byte[] bytes)
+ {
+ return Encoding.ASCII.GetString(bytes);
+ }
+
+ ///
+ /// Converts the given byte array of UTF-8 encoded text to a string.
+ /// Slower than but supports UTF-8
+ /// encoded data. Use this function if you are unsure about the
+ /// source of the data. For user input this function
+ /// should always be preferred.
+ ///
+ /// A byte array of UTF-8 characters (a character may take up multiple bytes).
+ /// A string created from the bytes.
+ public static string GetStringFromUTF8(this byte[] bytes)
+ {
+ return Encoding.UTF8.GetString(bytes);
+ }
+
//
// Hash the string and return a 32 bits integer.
//