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

Create Debian Live Installer Using Live-helper

Here is the simple way to Install your cusomize Debian Live into your machine 1.Set the two parameter in config/binary with by a.LH_DEBIAN_INSTALLER="live" b.LH_DEBIAN_INSTALLER_DISTRIBUTION="daily" 2.Give the access to /tmp folder in chroot chmod 777 /tmp 3.clean binary by lh_clean --binary 4.Rebuild ISO And now you can install your customized live CD in your machine ,which works fine .......

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.

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 "