Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 mynameisjohnj · Apr 06, 2017 at 09:41 PM · androidmobilewwwescape

Android - WWW cannot escape '#' character in .jar path

Hi All,

I'm not sure if this is something that just isn't possible, or if there's some sort of bug with the WWW implementation for .jar files.

I have a .flac file in my streamingassets folder with the following name and JAR path File: F#1_GUITHIGHBRIDGEH_tk 50.flac File Path: jar:file:///data/app/com.cakewalk.testSynth-2/base.apk!/assets/Godin Artisan/HighH/F#1_GUITHIGHBRIDGEH_tk 50.flac

This file fails to load with the following exception: java.io.FileNotFoundException: JAR entry assets/Godin Artisan/HighH/F not found

So it seems like the '#' character causes the path to get cut off (I have no problem getting the data from a WWW if no '#' is present.) That seems fair, seeing as '#' is a special URL character. The output of my full file path, after calling WWW.EscapeURL, is jar%3afile%3a%2f%2f%2fdata%2fapp%2fcom.cakewalk.testSynth-2%2fbase.apk%21%2fassets%2fGodin+Artisan%2fHighH%2fF%231_GUITHIGHBRIDGEH_tk+50.flac

which seems... incorrect (and raises a java.net.MalformedURLException.) I also tried escaping just the file name, but that actually yields a StringIndexOutOfBounds exception.

So do .jar URLs need to be escaped differently? Or is it just bad practice on Android to use the '#' character? Our solution has been to write a python script to go through and replace any '#' characters, but we're dealing with musical samples so many "sharp" keys have a '#' in the file name.

I don't see this issue with spaces, for the record, which are another forbidden URL character, but I'm not sure what the best practice here is. Any advice will be welcomed gladly.

  • John

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by aditya · Apr 07, 2017 at 01:37 PM

First of all i don't think it is that # but that SPACE is culprit and you should not escape the the URL as whole just escape the file name .... see @Bunny83 's answer HERE ... Plus i m not much experienced with this URL thingy on android but on PCs these # are used to direct to a ID on a page so i think you should remove that #

Comment
Add comment · Show 1 · 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
avatar image mynameisjohnj · Apr 07, 2017 at 03:43 PM 0
Share

Thanks for the response.

To test your answer, I replaced all '#' symbols with spaces and the file loaded fine on Android.

I think these .jar URLs are different from web URLs, so I'm not sure why the WWW class was re-purposed to read them (though I suspect this is the indirect cause of the bug.)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Clean Cache on Mobile 0 Answers

Could a Unity app running on Android install another APK on the device from the web? 1 Answer

unity3d www download of large texture mobile 0 Answers

Admob interstitial ad are slowing my game down 0 Answers

Porting simple game to android (Problem -> Controller) 0 Answers


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