Skip to content
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

Issue #31 - UTF-8 symbols and spaces in image URL #52

Merged
merged 6 commits into from
Aug 28, 2012

Conversation

johanols
Copy link
Contributor

Issue #31

Fixed issue with UTF-8 symbols and spaces in image URL as described in this thread:
#31

Fixed issue with UTF-8 symbols and spaces in image URL as described in
this thread:
nostra13#31
@johanols
Copy link
Contributor Author

Weird... I have no problem loading that Url.

Here is some code and a screenshot where the patched ImageLoader is able to download the image of the UTF-8 Url

http://imgur.com/WbwQ9

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ImageLoader imageLoader = ImageLoader.getInstance();

    // Initialize ImageLoader with configuration. Do it once.
    imageLoader.init(ImageLoaderConfiguration.createDefault(this));

    // Load and display image asynchronously
    ImageView iv = (ImageView) findViewById(R.id.imageView1);
    //imageLoader.displayImage("http://upload.wikimedia.org/wikipedia/commons/e/ee/你-red.png", iv);
    imageLoader.displayImage("http://upload.wikimedia.org/wikipedia/ru/b/b6/Как_кот_с_мышами_воевал.png", iv);
}

How does you test differ from mine?

@nostra13
Copy link
Owner

Interesting... I'll try to test it again later.

@nostra13
Copy link
Owner

I test my example project (UniversalImageLoaderExample) and this image is not displayed. (this URL at the end of list)

Relocated URL encoding of Uri from LoadAndDisplayImageTask.java to
ImageLoadingInfo.java

Encoding was not performed if disk caching was used.
Escaping more safe characters.
Removed unused reference
@johanols
Copy link
Contributor Author

I've relocated the Uri encoding to the constructor of ImageLoadingInfo. Now the UTF-8 image is shown in your test application as well.

@johanols
Copy link
Contributor Author

Shouldn't really matter since they're not vital to Url interpretation. I might as well add them also to the string since they are Url safe. I'll add them later this evening, run some tests and then commit the changes.

When it comes to your second string |^"%{}<> at least % have to be encoded since there might be pre encoded strings contained in the Url and we do not want to encode the % because that will ruin the Url. The others I think we should let them be encoded.

@johanols
Copy link
Contributor Author

I see now that you've included space. That character throws a URISyntaxException when parsed using java.net.URI. I'll leave that one out. The others are fine.

@nostra13
Copy link
Owner

No, it's my mistake. Space is unwanted.

nostra13 added a commit that referenced this pull request Aug 28, 2012
Issue #31 - UTF-8 symbols and spaces in image URL
@nostra13 nostra13 merged commit dfbff1d into nostra13:master Aug 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants