I came through this code (java), and was wondering if below two will have any actual difference in output:
String output1 = (URLEncoder.encode(plainString, "UTF-8")).toLowerCase();
String output2 = URLEncoder.encode(plainString.toLowerCase(), "UTF-8"));
First question why do you want to do lower case? URLs are case sensitive.
To answer your question - yes, there will be difference.
Using UTF-8 as the encoding scheme the string "The string ü@foo-bar" would get converted to "The+string+%C3%BC%40foo-bar" because in UTF-8 the character ü is encoded as two bytes C3 (hex) and BC (hex), and the character @ is encoded as one byte 40 (hex).
Now, in your this case -
(URLEncoder.encode(plainString, "UTF-8")).toLowerCase()
Hexa-decimal values will be converted to lower case.Consider below example:
Output:
Hope this helps!