-
Notifications
You must be signed in to change notification settings - Fork 48
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
Serialize xml: XML declaration returns utf-16 versus utf-8 #119
Comments
Hi @alwendt4, It looks like the uwp version of the XmlSerializer doesn't have the option to pass in the encoding so it's not an easy fix. I'll look at this in more detail tomorrow, hopefully I can put a fix in then as well. Thanks for reporting this. Cheers, Jark |
You are very welcome, Jark. Thanks for all of your hard work and saving me the time in not having to write my own RESTful webserver myself. Also, if there is any way I can control the ability to remove the namespaces on the root node, that would be cool ... but not critical (like the encoding attribute). To be specific, I'm talking about the attributes: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ... the engineers tell me that it's not that important, but who knows what they will pick at next. However, I'd rather the encoding attribute gets fixed so I can reload your package from NuGet as soon as possible, please. I've been told that this is the last obstacle in getting our prototype running, so I'm very excited. One final question ... would I be able to download the source, compile it, and use Restup from the code I compile into a stand-alone UWP application, or is Restup something I have to use from a NuGet package installed in Visual Studio (sorry if this is a dumb question)? |
Hi @alwendt4, We're probably not going to add the functionality for specifying to removing namespaces, what might be useful at some point would be to able to specify the namespaces, but I don't think we'll commit to that right now. We're always open to code submissions though :) I've added a pull request (#120) that should fix the issue. When a NuGet package is available I can't promise you, @tomkuijsten usually takes care of that and it's dependent on his time schedule, so it might be a couple of weeks before they're available. In the mean time you can manually build them by cloning / downloading my development branch on https://github.com/jark/restup/tree/development, build the solution and use the dlls from that build in your project. To answer your last question: any build/deploy method should copy the restup / any referenced dlls either next to the executable or in the package (.appx). |
FYI: I added the project directories: HttpMessage, WebServer, WebServerLogging, and Webserver.Models to a new solution (Background Application (IoT)). It compiled fine, but then when I added the DLLs {Restup.WebServer.dll, Restup.Webserver.Models.winmd}, and the using statements: using Restup.Webserver.File; using Restup.Webserver.Attributes; ... I got an error about the \WebServer\bin\ARM\Debug\Restup.Webserver.Models\About.txt not existing. I simply added an empty About.txt text file and the compile error abated. Additionally, event though I added the Restup.Webserver.Models.winmd reference to my solution, I couldn't shake the compiler warning: Could not resolve this reference. Could not locate the assembly "Restup.Webserver.Models". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. ... any advice? |
Additionally, I finally got the modules to compile and work with a simple headless application. The breakpoints in my controller class were hitting, but I was getting "No response" returned from the client. So do you have step-by-step instructions for building a deployable app using your source code? |
There's some information on the wiki, like the one-pager (https://github.com/tomkuijsten/restup/wiki/One-pager). Usually when you don't get a response back this means you're not keeping an instance of the http server alive / not asking the background task to stay alive (what's called a deferral). Try looking at the sample -> Building a deployable app using our source code shouldn't be any different then the usual process for your chosen platform, so we don't provide any instructions for that, sorry. |
Jark ... I tried everything. I can't get a response. Can you get @tomkuijsten to do a push and create a package soon, please? |
I try to take a look at the PR later tonight, bear with me. |
@tomkuijsten. You rock! Thank you very much. |
Will get to it tomorrow, got a bit late at home today. |
Come on @tomkuijsten! You're slow like an old woman! |
@tomkuijsten, I was just kidding with my last comment. I wanted to make you laugh. Any progress, please? |
Take a look at the PR #120 |
Serialize and deserialize with the correct encoding, fixes #119
@tomkuijsten thank you. But when I go to the NuGet - Solution Package manager in visual Studio I don't see an updated version. All I see is: Latest stable 1.0.0 (installed), and some other versions: 1.0.0, 1.0.0-rc1, 1.0.0-beta4, 1.0.0-beta2, etc. In PR #120 you were talking about "1.0.1-beta1", but I don't see it. I couldn't get restup to work by downloading and compiling source into DLLs (and you don't have instructions for that), only by installing the package through NuGet in Visual Studio. Can you advise? |
Yes, it's not published yet. You could download the package from the build output. The name of the package is not correct however, have to fix that, I hope tonight. |
Me again. Hummm. I tried to install the package found in "build output" by downloading and installing locally, and it failed. Here is the error (btw: I also installed the logging .nupkg first): Restoring packages for 'BackgroundApplication1'. |
I'll take a look at it tonight |
@tomkuijsten, any progress ??? ... I hate to sound pushy, and I really appreciate your work ... but I'm trying to get our prototype, which uses RESTUP, to the next phase and the UTF-16/UTF-8 thing is the only thing holding us up. |
@alwendt4 I understand your frustration :) I think this will help, latest build package should work (you don't need the logging package, is the same as on nuget). |
@tomkuijsten, You did it!!!!!!!!! UTF-8, just like I wanted! Thank you very much, you're terrific!!!!! I can't find your direct contact off of GitHub. Please send it to me however you can, and I will send you updates as to how are project is going. I recommend you do. I have not disclosed who I work for. Al |
@Jark did it, I only created the package, but good to hear it's working for you. We will discuss how we will publish this to nuget. |
@alwendt4 still working? :) |
Still working great. Really appreciate your help. I couldn't have done it without you, and had you not moved so quick, I would have been in a real bind. We have what we need now. Thanks again.
The prototype is in position to be readied into a functional application prototype with all components assembled. Your Restup component was used to send network commands and command responses between a Windows machine and a Raspberry Pi 3 loaded with IoT.
Full disclosure: On June 12-13 your Restup module will be included as part of an application used in an internal Siemens employee competition called the "Siemens Hackathon" held on June 12-13.
I am an Advanced Software Engineer over here and I have several robotics engineers and a medical device manufacturing engineer on the team I am leading.
The overall objective will be to produce low-cost robotics components compatible with one of Siemens leading manufacturing software control systems for the purpose of highly inexpensive robotic device prototypes. So basically any robotic device you can build with Raspberry Pi with IoT loaded can be integrated into one of Siemens leading commercial manufacturing execution systems.
Al
…________________________________
From: Tom Kuijsten <[email protected]>
Sent: Wednesday, June 7, 2017 5:41 AM
To: tomkuijsten/restup
Cc: alwendt4; Mention
Subject: Re: [tomkuijsten/restup] Serialize xml: XML declaration returns utf-16 versus utf-8 (#119)
@alwendt4<https://github.com/alwendt4> still working? :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#119 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AWPjlQwGbjzRpBLCuS8mpqqoJx_M1m1dks5sBnBBgaJpZM4NbjD8>.
|
I send a get request from my client with the Accept-Charset = UTF-8, but the xml declaration encoding attribute is set to UTF-16.
Here is what my response body xml looks like:
<?xml version="1.0" encoding="utf-16" ?>
<picture xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"filename="test.jpg">..."
Here is the object that is being serialized in .net:
How do I get the xml root node encoding attribute set to "utf-8"?
The text was updated successfully, but these errors were encountered: