add some utf8 getbytes help functions

master
UbitUmarov 2020-04-29 12:24:45 +01:00
parent 7b5934ea26
commit c39ffa4dd1
2 changed files with 18 additions and 0 deletions

View File

@ -72,6 +72,12 @@ namespace OpenSim.Framework
return sb.ToString(); return sb.ToString();
} }
public static byte[] EndToNBBytes(StringBuilder sb)
{
sb.Append("</llsd>");
return Util.UTF8NBGetbytes(sb.ToString());
}
// map == a list of key value pairs // map == a list of key value pairs
public static void AddMap(StringBuilder sb) public static void AddMap(StringBuilder sb)
{ {

View File

@ -247,6 +247,18 @@ namespace OpenSim.Framework
public static Encoding UTF8 = Encoding.UTF8; public static Encoding UTF8 = Encoding.UTF8;
public static Encoding UTF8NoBomEncoding = new UTF8Encoding(false); public static Encoding UTF8NoBomEncoding = new UTF8Encoding(false);
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static byte[] UTF8Getbytes(string s)
{
return UTF8.GetBytes(s);
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static byte[] UTF8NBGetbytes(string s)
{
return UTF8NoBomEncoding.GetBytes(s);
}
/// <value> /// <value>
/// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards) /// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards)
/// </value> /// </value>