Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf8 is not supported #785

Open
Krzywson opened this issue Oct 31, 2024 · 3 comments
Open

utf8 is not supported #785

Krzywson opened this issue Oct 31, 2024 · 3 comments

Comments

@Krzywson
Copy link

Hello,
I have got error after fetching from woo api

rest = new RestAPI(shop.ShopApiUrl, shop.KeyApi, secretId); wc = new WCObject(rest); var date = dateFrom.ToUniversalTime().AddMinutes(-3).ToString("u").Replace(" ", "T"); try { var ordersFromShop = await wc.Order.GetAll(new Dictionary<string, string>() { {"order", "desc" }, {"modified_after", date}, {"per_page", "100" }, {"status","pending,processing" } }); orders = ordersFromShop; } catch (Exception ex) { throw new Exception($"Ta linia powoduje błąd {ex.Message} {ex.InnerException} </br> {orders.ToString()}"); }
Error

'utf8' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')
System.Collections.Generic.List`1[WooCommerceNET.WooCommerce.v3.Order]

I check everything in woo. Has anyone encountered such an error?
I expect the problem is on the woocommerce side, as 2 other stores use the same C# method

@RBSystemService
Copy link

RBSystemService commented Oct 31, 2024

@Krzywson i've solved...
@XiaoFaye

I solved the problem.
I included in my program project not the nuGet package but all the solution.
Looking at the code doing the execution step by step, I saw that the real error was in the webrequest a 401 and 403 access denied error.
I tried to take the command that had been composed and putting it in the browser I correctly obtained the json with the data and so by documenting myself I saw that the user-agent was missing in the declaration of the variable that made the webrequest. so I added this code in the "RestAPI.cs" file after line 226:

httpWebRequest.UserAgent = @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36";


(Version of WooCommerceNET 0.8.6) @XiaoFaye URGENT!!!

since this morning I have the same problem.
No updates have been made to wordpress, woocommerce or the management system. How can this be solved?
Up until 2 days ago everything was working perfectly

'utf8' non è un nome di codifica supportato. Per informazioni sulla definizione di una codifica personalizzata, vedere la documentazione del metodo Encoding.RegisterProvider.
Nome parametro: name
in System.Globalization.EncodingTable.internalGetCodePageFromName(String name)
in System.Globalization.EncodingTable.GetCodePageFromName(String name)
in System.Text.Encoding.GetEncoding(String name)
in WooCommerceNET.RestAPI.d__55.MoveNext()
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() in WooCommerceNET.RestAPI.<SendHttpClientRequest>d__481.MoveNext()
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in WooCommerceNET.RestAPI.d__49.MoveNext()
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in WooCommerceNET.Base.WCItem1.<GetAll>d__10.MoveNext() --- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione --- in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in System.Runtime.CompilerServices.TaskAwaiter1.GetResult()

@Krzywson
Copy link
Author

Krzywson commented Nov 4, 2024

@RBSystemService I will check it out today. Gonna give result.

Thanks for replying

Krzywson pushed a commit to Krzywson/WooCommerce.NET that referenced this issue Nov 4, 2024
@Krzywson
Copy link
Author

Krzywson commented Nov 4, 2024

Its working. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants