feat: add ERP agent pet bridge and startup guide
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.AgentBridge
|
||||
{
|
||||
/// <summary>
|
||||
/// The bridge protocol is UTF-8 without replacement fallbacks. Silently
|
||||
/// normalizing malformed bytes or unmatched UTF-16 surrogates could change
|
||||
/// identifiers or business text after a caller calculated its binding.
|
||||
/// </summary>
|
||||
internal static class BridgeUtf8Codec
|
||||
{
|
||||
private static readonly Encoding StrictUtf8 =
|
||||
new UTF8Encoding(false, true);
|
||||
|
||||
internal static string Decode(byte[] source)
|
||||
{
|
||||
if (source == null) throw new ArgumentNullException("source");
|
||||
return StrictUtf8.GetString(source);
|
||||
}
|
||||
|
||||
internal static byte[] Encode(string source)
|
||||
{
|
||||
if (source == null) throw new ArgumentNullException("source");
|
||||
return StrictUtf8.GetBytes(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user