Cant use embed, UTF-8 is not a supported encoding name
trying to embed a Youtuve video in the RTE, this error happens:
System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: The character set provided in ContentType is invalid. Cannot read content as string using an invalid character set. ---> System.ArgumentException: '"UTF-8"' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
Parameter name: name
at System.Globalization.EncodingTable.internalGetCodePageFromName(String name)
at System.Globalization.EncodingTable.GetCodePageFromName(String name)
at System.Text.Encoding.GetEncoding(String name)
at System.Net.Http.HttpContent.<>cDisplayClass13_0.0(Task task)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Umbraco.Web.Media.EmbedProviders.EmbedProviderBase.DownloadResponse(String url) in d:\a\1\s\src\Umbraco.Web\Media\EmbedProviders\EmbedProviderBase.cs:line 54
at Umbraco.Web.Media.EmbedProviders.YouTube.GetMarkup(String url, Int32 maxWidth, Int32 maxHeight) in d:\a\1\s\src\Umbraco.Web\Media\EmbedProviders\YouTube.cs:line 24
at Umbraco.Web.PropertyEditors.RteEmbedController.GetEmbed(String url, Int32 width, Int32 height) in d:\a\1\s\src\Umbraco.Web\PropertyEditors\RteEmbedController.cs:line 58
---> (Inner Exception #0) System.InvalidOperationException: The character set provided in ContentType is invalid. Cannot read content as string using an invalid character set. ---> System.ArgumentException: '"UTF-8"' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
I have applied a custom Utf8 encoding provider (in a IComponent Initialize) I found somewhere (could not remember where, neither understand under the hood but hope someone here can input more to make it more clear)
public void Initialize()
{
Encoding.RegisterProvider(new CustomUtf8EncodingProvider());
}
public class CustomUtf8EncodingProvider : EncodingProvider
{
public override Encoding GetEncoding(string name)
{
return name.InvariantEquals("utf-8") ? Encoding.UTF8 : null;
}
public override Encoding GetEncoding(int codepage)
{
return null;
}
}
Cant use embed, UTF-8 is not a supported encoding name
trying to embed a Youtuve video in the RTE, this error happens:
System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: The character set provided in ContentType is invalid. Cannot read content as string using an invalid character set. ---> System.ArgumentException: '"UTF-8"' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Parameter name: name at System.Globalization.EncodingTable.internalGetCodePageFromName(String name) at System.Globalization.EncodingTable.GetCodePageFromName(String name) at System.Text.Encoding.GetEncoding(String name) at System.Net.Http.HttpContent.<>cDisplayClass13_0.0(Task task) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at Umbraco.Web.Media.EmbedProviders.EmbedProviderBase.DownloadResponse(String url) in d:\a\1\s\src\Umbraco.Web\Media\EmbedProviders\EmbedProviderBase.cs:line 54 at Umbraco.Web.Media.EmbedProviders.YouTube.GetMarkup(String url, Int32 maxWidth, Int32 maxHeight) in d:\a\1\s\src\Umbraco.Web\Media\EmbedProviders\YouTube.cs:line 24 at Umbraco.Web.PropertyEditors.RteEmbedController.GetEmbed(String url, Int32 width, Int32 height) in d:\a\1\s\src\Umbraco.Web\PropertyEditors\RteEmbedController.cs:line 58 ---> (Inner Exception #0) System.InvalidOperationException: The character set provided in ContentType is invalid. Cannot read content as string using an invalid character set. ---> System.ArgumentException: '"UTF-8"' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
Hi, Did you eve get an solution to this? I'm having the same problem when trying to add facebook video embed support
I have applied a custom Utf8 encoding provider (in a IComponent Initialize) I found somewhere (could not remember where, neither understand under the hood but hope someone here can input more to make it more clear)
public void Initialize() { Encoding.RegisterProvider(new CustomUtf8EncodingProvider()); }
So I have added this but it doesn't seem to be running this code
I forgot to note that it is a IComponent and then must be registered through a IUserComposer, e.g.
Thank you GP, I will try this But strange how this is not already built-in
I do not know, I cannot explain. It is a weird issue, but see that it just happens to a small number of Umb site (not much report about this issue).
is working on a reply...