aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ServerManager/WebSocketConnection.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/ServerManager/WebSocketConnection.cs')
-rw-r--r--Emby.Server.Implementations/ServerManager/WebSocketConnection.cs31
1 files changed, 2 insertions, 29 deletions
diff --git a/Emby.Server.Implementations/ServerManager/WebSocketConnection.cs b/Emby.Server.Implementations/ServerManager/WebSocketConnection.cs
index 4608a13e6..ac20fe7b3 100644
--- a/Emby.Server.Implementations/ServerManager/WebSocketConnection.cs
+++ b/Emby.Server.Implementations/ServerManager/WebSocketConnection.cs
@@ -13,7 +13,6 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Services;
using MediaBrowser.Model.Text;
-using UniversalDetector;
namespace Emby.Server.Implementations.ServerManager
{
@@ -137,7 +136,8 @@ namespace Emby.Server.Implementations.ServerManager
{
return;
}
- var charset = DetectCharset(bytes);
+
+ var charset = _textEncoding.GetDetectedEncodingName(bytes, null);
if (string.Equals(charset, "utf-8", StringComparison.OrdinalIgnoreCase))
{
@@ -148,33 +148,6 @@ namespace Emby.Server.Implementations.ServerManager
OnReceiveInternal(_textEncoding.GetASCIIEncoding().GetString(bytes, 0, bytes.Length));
}
}
- private string DetectCharset(byte[] bytes)
- {
- try
- {
- using (var ms = _memoryStreamProvider.CreateNew(bytes))
- {
- var detector = new CharsetDetector();
- detector.Feed(ms);
- detector.DataEnd();
-
- var charset = detector.Charset;
-
- if (!string.IsNullOrWhiteSpace(charset))
- {
- //_logger.Debug("UniversalDetector detected charset {0}", charset);
- }
-
- return charset;
- }
- }
- catch (IOException ex)
- {
- _logger.ErrorException("Error attempting to determine web socket message charset", ex);
- }
-
- return null;
- }
private void OnReceiveInternal(string message)
{