Skip to main content

Encode Unicode character to Utf-8 in url

URLs should only contain ASCII/Unicode charachter. That character set is quite restrictive if you want to use Gujarati characters for instance, so there is some encoding needed here. So if you've got a string with a Gujarati character and you want to link to it, you need to do this:

"કળા: -> "%E0%AA%95%E0%AA%B3%E0%AA%BE"

Thankfully this can be done with a bit of Java:

java.net.URLEncoder.encode("","UTF-8");

So, whenever you need to generate something for the address bar or a direct or something like that, you must URL encode the data. You don't have to detect this as it doesn't hurt to do this for links which are just plain as they don't get changed, as you can see with the string ending

Comments

Author said…
For URL encoding, to convert URL to safe format use the tool

encode url

Popular posts from this blog

Touching One .......................

Little girl and her father were crossing a bridge. The father was kind of scared so he asked his little daughter, "Sweetheart, please hold my hand so that you don't fall into the river. " The little girl said, "No, Dad. You hold my hand. " "What's the difference?" Asked the puzzled father. "There's a big difference, " replied the little girl. "If I hold your hand and something happens to me,chances are that I may let your hand go. But if you hold my hand, I know for sure that no matter what happens, you will never let my hand go. " In any relationship, the essence of trust is not in its bind, but in its bond. "So hold the hand of the person whom you love rather than expecting them to hold urs... this story tells many things... u just need to understand the meaning rest depends on u "

Are you afraid of the dark!!! -Sidney Sheldon

I have just finished reading this book ............... The book starts with the cops who find the dead bodies of various scientists. It tells us briefly about the lives of the two widows when they were married rather happily married. One widow being a high profile model the other being a girl next door kind of a person. This book is a story of the wives of two good scientist who escape death several times. The two lose their husband as they were murdered for being involved in a very high profile undercover project. The book describes how the two widows decide to find out the person involved in murdering their husband and in the process how do they escape death several times and finally whether did they die or not ? is a question which will be answered only after reading the book. ARE YOU AFRAID OF THE DARK? is a pleasant and easy read. While the story has its flaws, it certainly held my interest and kept me reading to the very end.

Add Favicon icon to drupal site

Now, to add it to drupal with a theme using the phptemplate engine is easy. Just upload the favicon.ico file to the base directory of your theme. The same directory your style.css file is in. Drupal will automatically detect it and do the work to make it display on your site. If you are using something other than drupal than to have your favicon display will need one more step. Once the file is uploaded to the sever, the following piece of code needs to be up on your web pages in the < head / > : < link rel="shortcut icon" href="/path/to/favicon.ico" type="image/x-icon" / > Just change the /path/to to the path to your favicon.ico file and your all set.