colinta / SublimeStringEncode

Converts characters from one "encoding" to another using a transformation (think HTML entities, not character encodings)
Other
150 stars 22 forks source link

URL Decode delete [+] symbol #26

Closed Kristinita closed 8 years ago

Kristinita commented 8 years ago

plus

colinta commented 8 years ago

Thanks for the video! This is not a bug, though, the + sign is a space in URLs.

Encoding a space can go one of two ways: either %20 (ASCII 32) or +. When encoding a +, though, it is always %2B (ASCII 43).

When decoding, though, the + will always decode into a space.

Kristinita commented 8 years ago

But documents often contain the text with a symbol + which isn't a part of URL. Its removal can strongly do much harm to contents of files.

I suggest to replace +`only in a case when the symbol+` is a part of URL, but in other cases not to delete it.

Thanks.

colinta commented 8 years ago

I don't understand - why are you decoding documents that aren't URLs? The whole point is to take a url like https://www.google.com/?q=this%3Ais+a%20%2Asilly%2A%20example%21 and decode it into https://www.google.com/?q=this:is a *silly* example!.

colinta commented 8 years ago

I think I might see what's going on - you're wanting it to decode URLs in a document? I just noticed that you didn't make any selection, in which case it defaults to "the entire document". But it doesn't try to detect what is a URL and what isn't (and I don't would not want to maintain a "detect URL" feature for such a simple plugin).

Instead, select the URLs manually, and then run the plugin, and it will only transform the selection(s).

Kristinita commented 8 years ago

I don't understand - why are you decoding documents that aren't URLs?

No, I decode documents contains many URL and many other text.

Instead, select the URLs manually, and then run the plugin, and it will only transform the selection(s).

If the document big and contains in it many URL, it will take away a lot of time and forces.

Thanks.

colinta commented 8 years ago

You can make this really easy by using regex search and "Find All"

url decode demo

If you're hoping that I'll take the time to add this feature that you want, I'm afraid I must disappoint. This can be accomplished very easily using multiple selections, so there's no point in adding this "feature" (I don't think it's a feature, because detecting URLs like This -> github.com <- url would be a PITA).

Kristinita commented 8 years ago

If you don't wish to correct, in my opinion, it is necessary to specify obviously that in the text which isn't containing URL is removed +, in README.md as the problem can seriously do much harm to documents of users, and people can not understand at once that + StringEncode is the reason of removal. Thanks.

colinta commented 8 years ago

seriously do much harm

This is very melodramatic. You can undo that operation. If you want this plugin to work differently, please fork it, change it, and be happy!

I've updated the README to warn against using it the way you are describing:

2d7196e02aecfe32917458c0e61555dff8887b32