Click here to Skip to main content
15,562,561 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need the final result to be
http://text:moretext@numbers:morenumbers/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Scan"}

and then open it with Process.Start();

But even though I manipulate the text as it should be, when I open it in process.start then the double quotes gets \ in front of it

When I view my string it is fine, it is only when I move it to the process.start it seems to include the \

I hope there is a smart person who can advice me

What I have tried:

I have tried to change the double quotes with \"

I have tried change to single quotes and then do a replace("'", "\"");

I tried also with @"http://text:moretext@numbers:morenumbers/jsonrpc?request={""jsonrpc"":""2.0"",""method"":""VideoLibrary.Scan""}"

All of them when moving it to process.start then it add the \ in fron of the double quotes, which makes the url not work as intended


Thanks for your efforts
Posted
Updated 14-Nov-17 23:20pm
Comments
Karthik_Mahalingam 14-Nov-17 5:57am    
show an example of input and expected output
F-ES Sitecore 14-Nov-17 6:00am    
The "\" isn't really there, your debugger is adding it to show the quote is a literal quote and not the start\end of a string. Your problem is no doubt elsewhere, replace the quote with " to make them url friendly.
Graeme_Grant 14-Nov-17 6:01am    
You tell us the final result without showing where you started or the code to get the result with the problem. We can't see your screen from here...

Please update the question with clear and concise details, sample code, any error messages (including inner exception details), etc, by clicking on the Improve question widget.
Member 13507572 14-Nov-17 6:11am    
I tried with "
Unfortunately, it came into the url

/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Scan"}

I get a JSON parse error (also with the other attempts)

error
code -32700
message "Parse error."
id null
jsonrpc "2.0"

You might be right, the error can be somewhere else. But if I manual put the url into the browser it works fine


Karthnik,

This is the expected result in the browser - http://kodi:Cami2017@192.168.178.194:8080/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Scan"}


Here is my attempt with single quote -

string tmpurl = @"http://text:moretext@number:morenumbers/jsonrpc?request={jsonrpc':'2.0','method':'VideoLibrary.Scan'}";


tmpurl = tmpurl.Replace("'","\"");

Process.Start(url);
Karthik_Mahalingam 14-Nov-17 7:06am    
use  Reply  button, to post Comments/query to the user, so that the user gets notified and responds to your text.

Replacing the " with %22 in my text string, resolved the issue
 
Share this answer
 
What you need to use for URL QueryString values is UrlEncode[^] for uncoding special characters like the " mark. I've given you a link with multiple versions - pick the one that best suits your type of application.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900