Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by bellicapax · Oct 12, 2016 at 10:13 PM · c#webrequestencoding

Prevent UnityWebRequest.url from decoding string

I'm trying to make a request to a url that contains %2F as part of the url

 var myUrl = "http://mydatabase.com/coolFolder%2FcoolFile";

However, when I enter this url in to a UnityWebRequest either via the constructor:

 var request = new UnityWebRequest(myUrl);

or via the property:

 request.url = myUrl;

the url becomes

 "http://mydatabase.com/coolFolder/coolFile"

And that will not let me access the proper url, so my request will fail. I assume Unity is decoding that behind the scenes and I cannot figure out any way to bypass that.

Help?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image elenzil · Oct 12, 2016 at 11:02 PM 0
Share

lol!

ugh, what a drag.

maybe you could try coolFolder%252fcoolFile ?

%25 is the encoding for %.

avatar image Tricnic · Oct 13, 2016 at 02:17 PM 0
Share

I just tried that, elenzil, and it didn't work, unfortunately. It seems that URI only decodes %2F and %2E automatically because coolFolder%252fcoolFile stayed coolFolder%252fcoolFile.

 string url1 = "http://example.com/" + "coolFolder/coolFile";
 var uwr1 = UnityWebRequest.GetAssetBundle(url1);
 Debug.Log(url1 + " -> " + uwr1.url);
 // http://example.com/coolFolder/coolFile -> http://example.com/coolFolder/coolFile
 string url2 = "http://example.com/" + "coolFolder/coolFile".Replace("/", "%2F");
 var uwr2 = UnityWebRequest.GetAssetBundle(url2);
 Debug.Log(url2 + " -> " + uwr2.url);
 // http://example.com/coolFolder%2FcoolFile -> http://example.com/coolFolder/coolFile
 string url3 = "http://example.com/" + "coolFolder/coolFile".Replace("/", "%252F");
 var uwr3 = UnityWebRequest.GetAssetBundle(url3);
 Debug.Log(url3 + " -> " + uwr3.url);
 http://example.com/coolFolder%252FcoolFile -> http://example.com/coolFolder%252FcoolFile
 

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by elenzil · Oct 13, 2016 at 04:27 PM

send in the sad trombones.

two other long-shots come to mind:

  1. modify the server to accept some other delimiter. This may not be an option of course.

  2. the ugui system is available from unity as source: you can tweak it and recompile the .dll. perhaps UnityWebRequest is the same ?

  3. report a bug. (free bonus suggestion!)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

228 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Multiple UnityWebRequest Headers returning 408 Timeout HttpError 0 Answers

Issue assigning JSON Data to Class Structure 0 Answers

How to get UnityWebRequest to work for downloading JSON 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges