Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 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 Haimmer · Jun 03, 2013 at 11:50 AM · wwwstringserviceutf-8

WWW object has doesnt return the full string

Im trying to fetch a JSON from this service: http://haimtest.azurewebsites.net/MuseumService.asmx/GetNews

you can see that in the browser it returns a pretty long json.

tried to get it into unity in UTF-8 charset with this code:

 IEnumerator GetNews()
 {
     WWW www = new WWW("http://haimtest.azurewebsites.net/MuseumService.asmx/GetNews");
         while(!www.isDone)
             yield return 0;
         Debug.Log(www.text);
         Debug.Log(www.size);
 }

the problem is that www.text doesnt have the full text that the service returns but only the first 454 chars of it: alt text

454chars.png (29.5 kB)
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by SubatomicHero · Jun 03, 2013 at 02:46 PM

I think you may need to alter the code to look like this:

 IEnumerator GetNews() {
     WWW www = new WWW("http://haimtest.azurewebsites.net/MuseumService.asmx/GetNews");
     yield return www;
     Debug.Log(www.text);
     Debug.Log(www.size);
 }
 
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 Mexallon · Jun 03, 2013 at 03:21 PM 0
Share

I also tried it that way because i find the while yield return 0 way strange. but the result is the same

avatar image
0

Answer by Haimmer · Jun 03, 2013 at 03:38 PM

Ok i found the problem. The service returned a text in utf-8 but something went wrong with the encoding there and for some reason the browser read it ok but unity didnt.

i just encoded the string differently on the service to return this: Context.Response.Write(Encoding.UTF8.GetString(encodedBytes));

insted of just a string

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

16 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

Related Questions

Encode String to URL friendly format 2 Answers

WWW & and strings in C# 1 Answer

Maximum WWW.text fetch size 1 Answer

Display Movie Name From www Address With A UI Text? 0 Answers

If Statement Acting Strange 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